100% Free · Open Source GPLv2 · Zero setup requiredGet the Plugin

Opens in a new tab
ITX UserOps

Back to Blog

WordPress Privilege Escalation: How to Check If a Subscriber Already Became an Admin

Patching a privilege escalation flaw does not undo one. Here is how to audit WordPress for rogue admin capability, altered roles, and attacker persistence.

Engineering

Terminal output of wp user list --role=administrator with four administrators, one registered at 03:17 from a throwaway email domain

A privilege escalation advisory tells you that a low-privilege account could have taken over your site. It does not tell you whether one already did. Patching closes the door; it does not sweep the room. On 1 October 2026, Patchstack published CVE-2026-15897 — an authenticated (Subscriber+) privilege escalation in Super Forms ≤ 6.3.316, scored CVSS 8.8 and patched in 6.3.317. If you run that plugin, update it. Then do the part almost nobody does, which is check.

This guide is the check. The commands below are not specific to Super Forms, or to any single advisory. They apply to any WordPress privilege escalation flaw, past or future, including the ones you will read about next month.

Table of Contents

Why patching is not the same as checking

Privilege escalation is a quiet class of bug. There is no defacement, no redirect, no spike in 500s. A Subscriber account — often one that registered legitimately months ago, or one the attacker created themselves through an open registration form — gains manage_options or a full administrator role, and the site keeps working exactly as before. The payoff comes later: a plugin upload, a modified functions.php, a second admin account created through the normal UI so it looks ordinary in the user list.

Two consequences follow, and both are the reason this audit exists.

First, the window matters more than the patch date. The relevant question is not “am I on 6.3.317?” but “was I running a vulnerable version at any point while an untrusted account existed on this site?” If your site allows open registration, or sells memberships, or runs a community, assume untrusted accounts existed.

Second, updating the plugin reverts nothing. A role written into the database stays written. An application password stays valid. A logged-in session stays logged in. The patch stops the next exploitation; it has no opinion about the last one.

Where WordPress actually stores a user’s role

Before running checks, it helps to know that “role” in WordPress is not one thing in one place. It is four, and an attacker only needs one of them.

LocationWhat lives thereTable
{prefix}capabilities user metaThe roles and any per-user capabilities assigned to that userwp_usermeta
{prefix}user_level user metaLegacy numeric level (10 = admin). Deprecated but still written and still read by some codewp_usermeta
{prefix}user_roles optionThe definition of every role on the site and what each role can dowp_options
site_adminsNetwork-wide super adminswp_sitemeta (multisite only)

Important Note: every {prefix} above is your actual table prefix. On a default install the meta key is wp_capabilities and the option is wp_user_roles. If your prefix is xyz_, they are xyz_capabilities and xyz_user_roles. Commands below assume the default; substitute your own.

The fourth location is the one most audits miss. An attacker who adds manage_options to the subscriber role definition does not appear anywhere in a list of administrators. Every subscriber on the site silently becomes an admin, and the user list still reads “Subscriber” next to each name.

Check 1: Every account that currently holds administrator

Start with the obvious one, and compare the output against the list of people who are supposed to have it.

wp user list --role=administrator --fields=ID,user_login,user_email,user_registered,display_name

Also check the legacy level, because some escalation payloads set it and nothing else:

wp db query "SELECT user_id, meta_value FROM wp_usermeta WHERE meta_key = 'wp_user_level' AND meta_value >= 10" --skip-column-names

On multisite, super admins are separate from any site’s administrator role and are frequently overlooked:

wp network meta get 1 site_admins --format=json

Then look at recent registrations regardless of role. An account created during the exposure window, with a role it should not have, is the clearest signal you will get:

wp user list --fields=ID,user_login,user_email,user_registered,roles --orderby=registered --order=DESC --number=30

Pro Tip: pay attention to the email domain and the gap between user_registered and first activity. Attacker-created accounts tend to cluster — several registrations within a few minutes, often with addresses at the same throwaway provider.

Check 2: Capabilities granted outside a role

This is where direct database writes show up. A clean user has a wp_capabilities value that contains exactly one role and nothing else, serialized like this:

a:1:{s:10:"subscriber";b:1;}

A user who has been handed a capability directly looks like this instead:

a:2:{s:10:"subscriber";b:1;s:14:"manage_options";b:1;}
Side by side serialized wp_capabilities values: a:1 containing only subscriber, and a:2 containing subscriber plus manage_options
The tell is the array count, not the capability name. a:1 is a user with one role; a:2 is a user who has been handed something directly.

Dump every value and read them. On a site with a few hundred users this takes two minutes, and it catches what a role filter cannot:

wp db query "SELECT user_id, meta_value FROM wp_usermeta WHERE meta_key = 'wp_capabilities'" --skip-column-names

For a large site, narrow it to the entries that mention a dangerous capability or a second array element:

wp db query "SELECT user_id, meta_value FROM wp_usermeta
  WHERE meta_key = 'wp_capabilities'
  AND (meta_value LIKE '%manage_options%'
       OR meta_value LIKE '%edit_users%'
       OR meta_value LIKE '%promote_users%'
       OR meta_value LIKE '%install_plugins%'
       OR meta_value LIKE '%unfiltered_html%'
       OR meta_value NOT LIKE 'a:1:%')" --skip-column-names

The NOT LIKE 'a:1:%' clause is the useful half: it surfaces every user carrying more than a single plain role, whatever the capability is called.

Check 3: Whether the roles themselves were rewritten

Now check the role definitions. This is the check that catches the invisible version of the attack.

wp eval 'foreach (wp_roles()->roles as $slug => $role) { echo $slug . ": " . implode(", ", array_keys(array_filter($role["capabilities"]))) . "nn"; }'

Read the output for the low-privilege roles specifically. A stock subscriber has exactly one capability: read. A stock contributor has read, edit_posts, delete_posts. If subscriber has picked up edit_users, manage_options, promote_users, install_plugins, edit_files, or unfiltered_html, you have your answer and you do not need to keep looking.

You can also pull the raw option, which is useful to diff against a known-good copy from a staging environment or a pre-incident backup:

wp option get wp_user_roles --format=json > roles-now.json

Important Note: plenty of legitimate plugins add capabilities to roles — WooCommerce, LMS plugins, membership plugins and form builders all do it. A non-stock capability is not automatically malicious. What matters is whether a low-privilege role has gained an administrative capability, and whether you can name the plugin that put it there.

Check 4: Registration and default-role settings

Two options decide how easy it is to get a foothold in the first place. Escalation chains frequently modify them, and the change is easy to miss because it lives on a settings screen nobody revisits.

wp option get users_can_register
wp option get default_role

default_role should be subscriber on almost every site. If it reads administrator, editor, or a custom role you do not recognise, then every new registration has been minting privileged accounts, and Check 1 needs re-running with that in mind.

Check 5: Persistence — sessions, app passwords, cron

Removing a rogue role does not log the attacker out. WordPress keeps authenticated sessions in user meta, and application passwords survive a password reset entirely.

For any account you consider suspect:

wp user meta get <ID> session_tokens
wp user meta get <ID> _application_passwords

An application password on an account that never uses the REST API is a strong signal. Across the whole site:

wp db query "SELECT user_id, meta_value FROM wp_usermeta WHERE meta_key = '_application_passwords'" --skip-column-names

Then check scheduled tasks and file integrity, because an attacker with admin capability usually leaves something that outlives the account:

wp cron event list
wp core verify-checksums
wp plugin verify-checksums --all

verify-checksums only validates plugins hosted on WordPress.org, so premium plugins and your own code are not covered. Treat a clean result as partial, not conclusive.

SQL versions if you have no WP-CLI

Managed hosts sometimes withhold shell access. The core checks run fine in phpMyAdmin or Adminer:

-- Every account with administrator in its capabilities
SELECT u.ID, u.user_login, u.user_email, u.user_registered, m.meta_value
FROM wp_users u
JOIN wp_usermeta m ON u.ID = m.user_id
WHERE m.meta_key = 'wp_capabilities'
  AND m.meta_value LIKE '%administrator%';

-- Users carrying more than one plain role
SELECT user_id, meta_value
FROM wp_usermeta
WHERE meta_key = 'wp_capabilities'
  AND meta_value NOT LIKE 'a:1:%';

-- The role definitions themselves
SELECT option_value FROM wp_options WHERE option_name = 'wp_user_roles';

-- Accounts registered in the exposure window
SELECT ID, user_login, user_email, user_registered
FROM wp_users
WHERE user_registered >= '2026-09-01'
ORDER BY user_registered DESC;

Adjust the date in the last query to the start of your exposure window, and the prefix throughout.

What to do if you find something

Order matters here, because the usual instinct — delete the account immediately — destroys the evidence you need to work out what else was touched.

  1. Take a database snapshot first. Before changing anything, so you can reconstruct the timeline later.
  2. Kill sessions and application passwords for the affected accounts. wp user session destroy <ID> --all and remove _application_passwords.
  3. Strip the capability, do not delete the user yet. wp user remove-role <ID> administrator and wp user set-role <ID> subscriber. The account’s history is useful.
  4. Repair the role definitions if Check 3 flagged them, from your known-good copy rather than by hand.
  5. Force a password reset for every administrator, and rotate any API keys, SMTP credentials and payment gateway secrets stored in the database.
  6. Then look for what the admin access was used for — new plugins, modified theme files, injected options, altered siteurl or home, new users created through the compromised account.
  7. Only then clean up the accounts.

If the site handles payments or personal data, step 1 is also the point at which your breach-notification clock may already be running. That is a legal question, not a technical one, and it is worth asking before you start deleting rows.

Why this is so hard to answer after the fact

Run through the checks above and you will notice something uncomfortable: every one of them tells you the current state of the database. None of them tells you when a role changed, or what changed it. You can prove a subscriber is an admin today. Proving one was an admin for six days in September, and is not anymore, is a different problem — and for most sites it is unanswerable.

The reason is structural. Most activity-logging plugins record role changes by hooking set_user_role, add_user_role and remove_user_role. Those hooks fire when code goes through the WordPress user API. A privilege escalation exploit frequently does not: it writes wp_capabilities directly with update_user_meta(), or rewrites the wp_user_roles option, and neither path fires a role-change hook. The log stays clean because nothing it watches for ever happened.

Closing that gap means watching the data rather than the API — detecting raw writes to wp_capabilities and changes to the role definitions themselves, and recording them somewhere an attacker with admin capability cannot quietly edit afterwards. That is the design goal behind the privilege-escalation watch and hash-chained activity log in ITX UserOps, which is our plugin, so weigh that accordingly. The broader point stands regardless of what you run: if your logging only sees role changes made the polite way, it will not see the ones that matter.

The practical takeaway is to run the five checks above now, store the output, and re-run them after the next advisory. A dated snapshot of who held what is worth more during an incident than any amount of retrospective guessing.

I hope this guide serves as a practical reference for auditing privilege escalation on WordPress. If I have missed a check worth adding, please leave a comment below.

A clearer WordPress admin
starts here.

Start with the free plugin. Add more control when you need it.

Log in

Vote on ideas, submit your own and join the discussion.