Difficulty: Intermediate
Important!: Before auditing this machine make sure you add the host “sunset-midnight” to your /etc/hosts file, otherwise it may not work as expected.
It is recommended to run this machine in Virtualbox.
This works better with ViritualBox rather than VMware

环境搭建

导入到VirtualBox到中,切换仅主机模式,Vmware的kaili主机桥接到virtualbox网卡。

使用arp-acan -l发现主机,排除1和29,剩下一个10就是靶机IP了,也可以通过MAC地址确定。

并把192.168.1.10 sunset-midnight写到/etc/hosts

靶机扫描

命令:nmap -A -T4 -p- -v 192.168.1.11
靶机开放端口:22,80,3306
IP绑定域名:sunset-midnight
Web程序:WordPress 5.4.2
HTTP服务器:: Apache/2.4.38 (Debian)

端口爆破

昨晚在TG上一个大佬跟我说:其他端口服务测试要优先于web端口的测试,因为web测试流程更长,兔子洞存在的可能性更高,其他端口测试相对单一直接..

所以咱们直接试试3306弱口令,尝试hydra爆破。

爆破成功,大佬说得对,花5分钟尝试其他端口,不会吃亏!

登录后直接查看管理员数据库,破解密文或者用一个也知名文的密文替换。

使用hash-identifier识别密钥类型,提示可能是”Wordpress”的md5。

同时尝试wpscan爆破admin用户密码:wpscan --url http://sunset-midnight/ -U username -P /usr/share/wordlists/rockyou.txt -t 100
爆破登录密码失败告终!!!

把admin加密成md5更新密码:21232f297a57a5a743894a0e4a801fc3

更新完后退出数据库,尝试admin-admin登录后台

登录成功!!!

WebShell

修改404.php把shell放上去,访问404页面成功反弹shell回kali

地址:http://sunset-midnight/wp-content/themes/twentytwenty/404.php
反弹回来的shell权限很低,user flag都看不了,对靶机继续提权。

使用python优化终端,或者返回好看的终端:
python -c 'import pty;pty.spawn("/bin/bash")'

后来在wordpress配置文件找到了jose数据库用户账号密码,尝试su jose

由于这个反弹终端不太好用,尝试使用ssh登录jose,登录jose后可以获得user.txt

user flag:956a9564aa5632edca7b745c696f6575

Root提权

执行命令:find / -perm -4000 -type f 2>/dev/null
该命令能查找出有SUID权限的命令,f是普通文件,2>后是屏蔽错误
参考文章:
https://blog.csdn.net/boqiangqing9840/article/details/100967938
https://www.cnblogs.com/iaknehc/p/6881517.html

执行/usr/bin/status时提示sh: 1: service: not found

所以使用service即可提权,使用ssh-keygen建立长久连接吧

最后还是到了激动人心的时刻,查看flag