본문 바로가기

Computer Security/CTF

[defcon 2013] gnireenigne, musicman, exploit

파일 헤더의 41~44바이트 부분을 조작함으로써, ReadChar 함수에서 읽는 부분을 조작할 수 있다.


이렇게 오프셋을 100만칸 옮기고, 파일을 다운받는다.


그리고 , IDA로 ReadChar의 소스를 긁어와서 컴파일 한후, 다운받은 파일을 다시 글자로 변환한다.


from socket import * from struct import *   s = socket(AF_INET,SOCK_STREAM) s.connect(('musicman.shallweplayaga.me',7890)) length=0 f = open('file','wb') while True: get=s.recv(0xffff) f.write(get) length = length + len(get) if length >= 211724: break f.close() print "recv1 end" f = open('file','rb') send_data=f.read() f.close() offset = unpack('<I',send_data[40:44])[0] offset = pack('<I',offset+1000000) s.send(send_data[:40]+offset+send_data[44:]) print "send" total=0 f = open('file2','wb') while True: get = s.recv(50000) total = total+ len(get) f.write(get) print "total: "+str(total) #print s.recv(50000) f.close() s.close()


'Computer Security > CTF' 카테고리의 다른 글

[SIGINT 2013] proxy exploit  (0) 2013.07.08
[defcon 2013] annyong exploit  (1) 2013.06.28
[defcon 2013] \xff\xe4\xcc, linked, exploit  (0) 2013.06.17
[defcon 2013] 3dub, babysfirst, exploit  (0) 2013.06.17
[HDCon 2013] 5번 문제 write up  (6) 2013.06.08