Author Topic: buffer overflow -opcode is saved as ascii text instead of address to be executed  (Read 645 times)

0 Members and 1 Guest are viewing this topic.

Offline AnAnimal

  • NULL
  • Posts: 4
  • Cookies: 0
    • View Profile
Hi All

I am learning basics of buffer overflow with mainly shellcoder's handbook (+ google ofc).
Purpose of this excercise is to redirect flow of program.

According to the book, i should overwrite RET with address of other instruction, (in this case 0x0804844e). I can control where the input can be stored, however the book says to overwrite RET with address encoded in the way \x4e\x84\x04\x08.

But when i do so, I get SEGFAULT, and upon debugging it says that EIP was not overwritten with custom address, but with half of this code, encoded in hex. So what I get here is e.g. 0x5c783465 value of EIP which is ascii represenatation of \x4e (or similarly, I have tried various input lenghts but I never managed to encode any address in style \xYY)

Could anyone help me and tell me what i'm doing wrongly? How to store complete address to RET without having it encoded to ASCII?


Offline TheWormKill

  • EZ's Scripting Whore
  • Global Moderator
  • Knight
  • *
  • Posts: 257
  • Cookies: 66
  • The Grim Reaper of Worms
    • View Profile
Well, you need to add raw bytes to your input, not just a string, that's obvious, isn't it? How you do that should be equally obvious and depends on your way of input.
« Last Edit: January 30, 2016, 12:53:31 pm by TheWormKill »
Stuff I did: How to think like a superuser, Iridium

He should make that "Haskell"
Quote
<m0rph-is-gay> fuck you thewormkill you python coding mother fucker