Login Register




The stories and information posted here are artistic works of fiction and falsehood. Only a fool would take anything posted here as fact.


Why does buffer overflow work one way but not the other? filter_list
Author
Message
RE: Why does buffer overflow work one way but not the other? #4
This is actually pretty simple.

When you do it by printing the values using the Python interpreter, note that some of it is binary - unprintable characters. In this instance, what is being printed out and passed to the program is binary-data. This is handled as an invalid memory address pointing to 0xdeadbeef when it overwrites the register.

Code:
$ python -c 'print "A"*20 + "\xef\xeb\xad\xde"' AAAAAAAAAAAAAAAAAAAA���

Now, when you just paste in the characters, you are passing it the invalid memory address not as binary, but as a set of ASCII characters, and it doesn't see it as an address pointing to 0xdeadbeef, it sees it as whatever the fuck else.

This is binary exploitation 101, yo. Learn how different data types are treated differently and you will succeed.

Bonus round: you can do this with echo as well.

Code:
$ echo -ne 'AAAAAAAAAAAAAAAAAAAA\xef\xeb\xad\xde' AAAAAAAAAAAAAAAAAAAA���

Enjoy learning.

Reply





Messages In This Thread
RE: Why does buffer overflow work one way but not the other? - by spjallþráð - 10-04-2015, 06:16 PM