作者:缘来是你明 | 来源:互联网 | 2024-11-17 20:50
Vulnhub DC3 实战记录与分析

经验与总结
平时应多积累漏洞知识,临时搜索时也要多方面搜集信息。尽管 Metasploit 中有针对 Joomla 3.7 的 RCE 工具,但其适用范围有限。此次实践中,我们通过 sqlmap 成功获取了后台密码。
深入研究 CMS 框架如 Joomla,了解其模板和脚本编写机制,有助于提高渗透测试效率。
靶机可能会因自动更新而导致 web 服务故障,这是常见的问题,需提前做好预防措施。
内核提权漏洞风险较大,建议将其作为最后的手段。本次测试中,首次尝试内核提权时导致靶机崩溃。
使用 sqlmap 时,可以通过 -C 参数指定需要 dump 的字段,提高数据提取的精确性。
除了 hashcat,John the Ripper 也是一个强大的密码破解工具,能够自动识别哈希类型。
使用 hashid 识别哈希字符串时,建议使用单引号以避免转义问题。
步骤详细记录
1. 使用 netdiscover 工具探测靶机 IP 地址为 192.168.1.104。
2. 使用 nmap 进行端口扫描,确认开放的端口为 80。

3. 访问 web 页面,初步了解目标网站。

4. 使用 whatweb 扫描工具,确认网站框架为 Joomla。

5. 使用 dirb 工具扫描网站路径,获取更多有用信息。

6. 使用 JoomScan 扫描工具,确认 Joomla 版本为 3.7.0。

7. 使用 searchsploit 工具查找 Joomla 3.7.0 的已知漏洞。

8. 尝试使用 Metasploit 中的 RCE 模块,但因版本不匹配或无法利用而失败。

9. 通过 POC 验证 SQL 注入漏洞的存在(靶机因自动更新问题,重新导入后 IP 变更为 192.168.1.101)。
http://192.168.1.101/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)

10. 使用 sqlmap 攻击,获取数据库信息。

11. 获取数据库名和表名。

12. 使用 sqlmap 命令 dump users 表中的 id、username 和 password 字段。

13. 使用 John the Ripper 破解密码。

14. 使用破解后的密码登录后台管理页面。
15. 利用模板管理功能添加一个 PHP 页面,部署回连脚本。

16. 访问 http://192.168.1.101/templates/beez3/html/shell.php,成功获取回连 shell。

17. 查看开放端口,确认没有 SSH 服务。

18. 靶机再次崩溃,怀疑是自动更新问题,重新导入虚拟机并设置为 host-only 模式。

19. 考虑内核提权漏洞,检查 gcc 是否可用。

20. 查看内核版本。

21. 在 searchsploit 中搜索合适的提权脚本。

22. 测试多个提权脚本,最终使用 Linux Kernel 4.4.x (Ubuntu 16.04) - 'double-fdput()' bpf(BPF_PROG_LOAD) 提权成功。

