📦 WordPress
What is it?
- Concept: The most common PHP CMS. Admin panel at
/wp-admin, content/plugins/themes under/wp-content. Built around hooks; the active theme’sfunctions.phpruns on every request. - Impact: Large attack surface — weak creds, vulnerable plugins/themes, and admin → RCE via the theme/plugin editors.
How it works
- Two login surfaces:
/wp-login.php(cookie auth for/wp-admin) and the REST API (/wp-json/...or?rest_route=...). - Roles/capabilities gate a logged-in user (subscriber < contributor < author < editor < administrator).
- The active theme’s
functions.phpis PHP loaded on every front-end and admin request — admin write access there is code execution.
Security Quirks & Niche Facts
- Two separate auth systems (trips people up constantly):
- Cookie auth:
GET /wp-login.phpfirst — WordPress setswordpress_test_cookieand refuses the POST if it doesn’t come back. ThenPOST /wp-login.php→wordpress_logged_in_<hash>cookie, valid for/wp-admin/*. - REST API needs a nonce, not just the cookie: a valid cookie alone returns
{"code":"rest_not_logged_in"}(HTTP 401) — misleading; it means “no nonce.” Fetch it from/wp-admin/admin-ajax.php?action=rest-nonce(needs the cookie) and send it as headerX-WP-Nonceon REST calls.context=editis what makescapabilitiesappear, e.g.GET /?rest_route=/wp/v2/users/me&context=edit.
- Cookie auth:
- Anonymous-readable paths:
/wp-content/uploads/<YYYY>/<MM>/(uploaded media — frequently leaks docs/audio/backups),readme.html(version),/wp-json/wp/v2/usersand/?author=N(username enumeration),xmlrpc.php. functions.php= RCE for admins: Appearance → Theme File Editor (theme-editor.php), or any admin write to the active theme’sfunctions.php, runs PHP on every request.- The capability map is a claim; a 403 is a fact — confirm access by hitting the actual admin screens, not by trusting the capability list.
- SQLite-backed WP (via a plugin) stores users in
wp-content/database/.ht.sqliteinstead of MySQL;wp-config.phpstill holds secrets and is prime loot (DB password is often reused for SSH).
Related Techniques
Notes
- Hashes in
wp_usersare$wp$/$2y$(bcrypt) — strong; don’t waste time cracking. Prefer credential reuse fromwp-config.phpor an admin-takeover path.
Mitigation
- Fix: Strong creds + 2FA, least-privilege roles, keep core/plugins/themes patched, set
DISALLOW_FILE_EDIT, and restrict/wp-admin+xmlrpc.php.
Related Usage
| File | Created |
|---|---|
| HTB Machine - MakeSense | September 14, 2026 |
References: