2

I'm attempting to do a buffer overflow with gets(). I've figured out how to write over the return address and I'm able to do so, however, I cannot write in the address I need because the 0x7F at the beginning of the address is being parsed weird. For example, overflowing with b"\x7f" * 150 shows in the stack as as all 00. Further, it seems that values after these 0x7F bytes overwrite where the 00s are.

In the picture below you can see a test where I overflowed with bytes from 0x00 up to 0xFF. As you can see, 0x7F is non-existant because it has been written over by the values after it for some strange reason.

I'm fairly confident this has something to do with gets() treating the 0x7F weird but I'm not sure how to work around this. Any help much appreciated!

enter image description here

Edit: Okay, so I just realized that 0x7F corresponds to the del (delete) ascii character which would explain the odd behavior. So I guess my question is still how to work around this?

1
  • I've edited the image to be more clear, please read the post to see what I'm talking about. I've written in the sequence in order so it should be like: 7a 7b 7c 7d 7e 7f 80. However, it seems like gets() is parsing it strangely as the order appears as 7a 7b 7c 7d 80. No need to be snarky, I've never asked here before. If this isn't the appropriate place to post this then where else could I ask?
    – user42774
    Dec 24, 2022 at 21:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.