4. Overwrite EIP
Last updated
Was this helpful?
Last updated
Was this helpful?
We use the offset to overwrite to EIP
Copy the output and place it into the payload variable of the script.
On Windows, in Immunity Debugger, re-open the oscp.exe again using the same method as before, and click the red play icon to get it running. You will have to do this prior to each time we run the (which we will run multiple times with incremental modifications).
On Kali, run the modified script: python
The script should crash the oscp.exe server again. This time, in Immunity Debugger, in the command input box at the bottom of the screen, run the following mona command, changing the distance to the same length as the pattern you created:
Mona should display a log window with the output of the command. If not, click the "Window" menu and then "Log data" to view it (choose "CPU" to switch back to the standard view).
In this output you should see a line which states:
Update your script and set the offset variable to this value (was previously set to 0). Set the payload variable to an empty string again. Set the retn variable to "BBBB".
Restart oscp.exe in Immunity and run the modified script again. The EIP register should now be overwritten with the 4 B's (e.g. 42424242).