Search

[pwnable.kr] input

tag
write-up
Last edited time
2022/01/07 12:50
Category
pwnable.kr
Visibility
Public

1. 문제

1) mitigation 확인
2) 문제 확인
소스코드를 보면 Stage 5 까지 입력을 알맞게 줘야 flag가 출력되는걸 알 수 있다.

2. 접근방법

쉬운 문제이지만 pwntools argv, env, stderr 등을 인자로 줄수 있다는 것을 새로 알았다. 또한 소켓 통신시 요청을 보낼때 그냥 remote()로 열고 send로 보내도 가능하다.

3. 풀이

from pwn import * context(log_level="DEBUG") args=[] for i in range(100): args.insert(i,'A') args[65]="\x00" args[66]="\x20\x0a\x0d" args[67]="9999" with open('./stderr','w+') as fd: fd.write("\x00\x0a\x02\xff") with open('\x0a',"w") as f: f.write("\x00\x00\x00\x00") p=process(executable="/home/input2/input",env={"\xde\xad\xbe\xef":"\xca\xfe\xba\xbe"},argv=args,stde$ p.sendline("\x00\x0a\x00\xff") p.sendline("") s=remote("127.0.0.1",9999) s.sendline("\xde\xad\xbe\xef") p.interactive()
Python
복사

4. 몰랐던 개념