Hero CTF 2023 - Impossible v2 (fsb)
Your colleague trolls you again by giving you an impossible challenge, betting $200 that, this time, you won’t succeed. Show him that this impossible challenge is in fact easy!
Host : nc static-03.heroctf.fr 5001
Format : Hero{flag}
Author : SoEasY
easy
- [41 solves / 428 points]
Analysis
아래처럼 fsb가 발생한다. (buf가 우리의 입력값이다.)
1 | sprintf(message, buf); |
message를 출력해주는 기능이 없기 때문에 뭔가 leak할수가 없다.
1 | payload = b'' |
위 paylaod로 입력을 보내고 디버거 상으로 message를 확인하면 아래와 같이 offset이 7임을 확인할 수 있다.
1 | gef> x/s 0x000000004040e0 |
fsb가 발생한 후, if (!memcmp(message, expected, 0x10uLL))가 참이면 flag.txt를 출력해준다.
pie도 안걸려있으니 memcmp@got에 flag.txt가 출력되는 주소를 덮어줬다. 길이가 충분하지 않으니 2바이트만 덮어주었다.
Solve
Exploit Code
1 | from pwn import * |