📦 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’s functions.php runs on every request.
  • Impact: Large attack surface — weak creds, vulnerable plugins/themes, and admin → RCE via the theme/plugin editors.

How it works

  1. Two login surfaces: /wp-login.php (cookie auth for /wp-admin) and the REST API (/wp-json/... or ?rest_route=...).
  2. Roles/capabilities gate a logged-in user (subscriber < contributor < author < editor < administrator).
  3. The active theme’s functions.php is 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.php first — WordPress sets wordpress_test_cookie and refuses the POST if it doesn’t come back. Then POST /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 header X-WP-Nonce on REST calls. context=edit is what makes capabilities appear, e.g. GET /?rest_route=/wp/v2/users/me&context=edit.
  • Anonymous-readable paths: /wp-content/uploads/<YYYY>/<MM>/ (uploaded media — frequently leaks docs/audio/backups), readme.html (version), /wp-json/wp/v2/users and /?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’s functions.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.sqlite instead of MySQL; wp-config.php still holds secrets and is prime loot (DB password is often reused for SSH).

Notes

  • Hashes in wp_users are $wp$/$2y$ (bcrypt) — strong; don’t waste time cracking. Prefer credential reuse from wp-config.php or 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.
FileCreated
HTB Machine - MakeSenseSeptember 14, 2026

References: