Another possible way to jump to shellcode is using the PUSH ESP, RET technique. If you’ve got no usable CALLs or JMPs to ESP for some reasons, you can first use a PUSH ESP to put the address of ESP onto the Stack and after that RET that value to the EIP. So this is only slightly different to a CALL or JMP, but does the job too.

All we have to do is to find a PUSH ESP, RET (opcode: 54 C3) in the loaded application:

I’ll take one from a system DLL called “ws2_32.dll”. The new Python script looks like this:

Start the application and load the malicious .wav (by the way: I used some “\xCC” to break the application – flow here) and have a look at the Stack. The ESP has been pushed onto the Stack @0x1BDFEE4, which points directly to the shellcode. Again: A working exploit 🙂 !

Buffer Overflow Exploitation: Jump to shellcode via PUSH ESP, RET
Tagged on:                 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.