wordpress.org Rosetta: invite stores unvalidated role — Editor can assign site Administrator despite editable_roles
A wordpress.org mu-plugin saved the role from an invite request without checking the editable roles list, so an Editor on a Rosetta locale site could submit the administrator role and have it applied when the invite was accepted. This let an Editor elevate an account to site Administrator, bypassing the intended restriction.
- Fixed in 26 days
- Paid in 26 days
- Disclosed after 3 months
Summary by the researcher
On Rosetta locale sites, Editors can invite users but are not supposed to make anyone a site Administrator — WordPress normally blocks that via editable_roles. A wordpress.org mu-plugin saved the invited user’s role from the HTTP request without checking that list, so an Editor could force role=administrator and elevate an account when the invite was accepted.
The report
Summary
On Rosetta locale sites (e.g. xx.wordpress.org/team/), Editors are intentionally allowed to invite existing network users (promote_users) but are blocked from assigning the Administrator role via the official WordPress editable_roles filter (unset( $roles['administrator'] ) for non–super-admins).
The wordpress.org mu-plugin wporg-add-existing-users-via-username.php breaks that boundary: on admin_action_adduser it persists the invite option with role taken directly from $_REQUEST['role'] before consulting get_editable_roles(). Core’s /newbloguser/{key}/ path then applies the stored role via add_existing_user_to_blog() → set_role() with no wp_ensure_editable_role() re-check.
An Editor can therefore POST role=administrator (not offered in the UI dropdown), create a valid invite, and elevate an account to site Administrator (manage_options on that blog).
This is not by design. Official WordPress documentation states that get_editable_roles() / editable_roles exist specifically so that delegated user managers (editors/authors) cannot make others administrators. Rosetta implements that filter. The invite path ignores it. Since WordPress 6.8, Core also provides wp_ensure_editable_role() to enforce the allowlist server-side — but that check is not applied before invite persistence in this mu-plugin (and Core’s own invite branch still lacks it before add_option in some paths).
This is not the Learn / workshop_reviewer case: Learn does not remove Administrator from editable_roles, so there is no privilege-boundary bypass there. Rosetta does remove it.
Official documentation (intended security model)
From WordPress Developer Resources — get_editable_roles():
Main purpose is to allow filtering of roles so that plugins can remove inappropriate ones… Specifically because without filtering anyone with the edit_users capability can edit others to be administrators, even if they are only editors or authors. This filter allows admins to delegate user management.
editable_roles — list of roles a user can assign to others.
wp_ensure_editable_role() (since 6.8.0) — stop execution if the role cannot be assigned by the current user (403).
Rosetta relies on that model; the invite mu-plugin does not enforce it.
Affected Asset / Component
- Program asset: WordPress (HackerOne) — wordpress.org custom code / Rosetta
- Sites: Rosetta locale team / main (path
/team/and locale main customizations) - Mu-plugin:
wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-add-existing-users-via-username.php - Rosetta boundary:
…/plugins/rosetta/inc/site/class-locale-team.php(alsoclass-locale-main.php) - Core apply path:
wp-includes/ms-functions.php—maybe_add_existing_user_to_blog()/add_existing_user_to_blog()/add_user_to_blog()
Vulnerable Code
1) Rosetta — intentional boundary (Editors may invite; must NOT assign Administrator)
// rosetta/inc/site/class-locale-team.php
public function extend_editors_capabilities( $allcaps, $caps, $args, $user ) {
if ( ! in_array( 'editor', $user->roles ) ) {
return $allcaps;
}
$allcaps['list_users'] = true;
$allcaps['promote_users'] = true;
$allcaps['remove_users'] = true;
return $allcaps;
}
public function remove_administrator_from_editable_roles( $roles ) {
if ( ! is_super_admin() ) {
unset( $roles['administrator'] );
}
return $roles;
}
2) Mu-plugin — persists unvalidated $_REQUEST['role'] BEFORE editable check
// wporg-add-existing-users-via-username.php (non–super-admin path)
$new_user_key = substr( md5( $user_id ), 0, 5 );
add_option( 'new_user_' . $new_user_key, array(
'user_id' => $user_id,
'email' => $user_details->user_email,
'role' => $_REQUEST['role'], // UNVALIDATED
) );
$roles = get_editable_roles(); // too late — only used for email text
$role = $roles[ $_REQUEST['role'] ];
// wp_mail( … translate_user_role( $role['name'] ) … )
If role=administrator is not in get_editable_roles(), email rendering may warn / show empty role name, but add_option already succeeded.
3) Core — applies stored role with no editable re-check
// wp-includes/ms-functions.php
function add_existing_user_to_blog( $details = false ) {
if ( is_array( $details ) ) {
$result = add_user_to_blog( get_current_blog_id(), $details['user_id'], $details['role'] );
// …
}
}
// add_user_to_blog() → $user->set_role( $role ); // no wp_ensure_editable_role()
Correct pattern (already in Core 6.8 for other paths)
wp_ensure_editable_role( $_REQUEST['role'] ); // used on some create / noconfirmation paths
Invite persistence in this mu-plugin never calls it.
Local validation (source-faithful lab)
Authorized source review + local Multisite lab (not production wordpress.org):
WordPress Multisite + production copy of wporg-add-existing-users-via-username.php
Rosetta-equivalent editable_roles filter (unset administrator) + Editor promote_users
Created lab_editor (Editor) and lab_victim (not yet on blog)
Stored invite with role=administrator (same order as mu-plugin)
Called Core add_existing_user_to_blog()
DB proof:
lab_victim wp_capabilities a:1:{s:13:"administrator";b:1;}
Victim had manage_options = true. Invite key shape matches mu-plugin: substr( md5( user_id ), 0, 5 ).
Suggested fix
Call wp_ensure_editable_role( $_REQUEST['role'] ) (or equivalent) before add_option.
Persist only the validated role string from get_editable_roles().
Defense in depth: re-validate in Core add_existing_user_to_blog() before set_role.
Prefer non-deterministic invite keys (Core invite already uses longer random keys; mu-plugin uses substr(md5(user_id),0,5)).
Researcher: 0xbs0d27
## Impact
Authenticated Editor on a Rosetta locale site can escalate another network account (including one they control) to **site Administrator**, bypassing the explicit `editable_roles` removal of Administrator. Impact is full control of that site (`manage_options`), not network super-admin. Severity assessed **High** given Editor prerequisite; Critical may be considered for site takeover on wordpress.org properties.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The mu-plugin persisted the role from the request before consulting get_editable_roles(), and the Core invite path applied the stored role without re-checking it.
Impact
An authenticated Editor could escalate another network account, including one they control, to site Administrator with full control of that site, though not network super-admin.
What the attacker needed
An Editor account on a Rosetta locale site; an existing network user to invite
The fix
The role should be validated with wp_ensure_editable_role() or the editable roles list before the invite is stored, and re-checked before the role is applied.
How it was found
- As an Editor on a Rosetta locale site, send an invite request that includes the administrator role.
- The mu-plugin stores the invite with that unvalidated role.
- The invited account accepts the invite via the newbloguser path.
- Core applies the stored role, making the account a site Administrator.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
WordPress lets site owners decide which roles a lower-level manager may hand out. On these locale sites, Editors are allowed to invite people but are meant to be blocked from making anyone an Administrator. The invite code saved whatever role was sent in the request instead of checking the allowed list, so an Editor could sneak in the Administrator role.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.