I am trying to create a C program that send inputs to a file in order to produce an overflow. In my C program I defined the name of the target program and the args and I've used execv :
#define DEST_PROG "./myapp"
//then I defined the input using:
char* argParam[4];
argParam[0] = DEST_PROG;
argParam[1] = "AAAAAAAAAA";
argParam[2] = "BB\xaa\xaa\xaa\xaa";
argParam[3] = NULL;
execv(DEST_PROG, argParam);
return 0;
}
When I invoke execve the program sends the input but I don't get segmentation fault, the ret address does not get overwritten.
From the command line it works fine. .With the following line, which sends the same two inputs the ret address gets overwritten : 0xaaaaaaaa.
./myapp $(python -c 'print "A"*10+ "\t"+"BB\xaa\xaa\xaa\xaa"')
Thank you