Pivilege escalation of any new user to Keymaster caused by CSRF
bbPress assigns a forum role from a user-controlled POST parameter during registration without adequate CSRF protection. An attacker could trick a logged-in admin into submitting a crafted registration request that creates a new user with the Keymaster forum role.
- Fixed in 10 days
- Paid in 10 days
- Disclosed after 7 months
An attacker can escalate a newly registered user's forum role to bbp_keymaster without proper authentication. This occurs because bbPress fails to implement adequate CSRF protections when assigning forum roles, allowing an attacker to craft a malicious request that upgrades a targeted user’s forum privileges upon registration.
When an authenticated admin user visits the link, an new user is registered with the attacker's details, they receive an email containing login credentials.
Root Cause The bbp_user_add_role_on_register function assigns a user role based on a user-controlled POST parameter (bbp-forums-role).
Steps To Reproduce:
- Install and activate the bbpress plugin.
- Here is my CSRF form for the PoC.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loading...</title>
</head>
<body onload="document.getElementById('csrf-form').submit();">
<form id="csrf-form" action="http://localhost/victim/wp-login.php" method="POST">
<input type="hidden" name="user_login" value="evilpen">
<input type="hidden" name="user_email" value="[email protected]">
<input type="hidden" name="action" value="register">
<input type="hidden" name="bbp-forums-role" value="bbp_keymaster">
</form>
</body>
</html>
- Set up your wordpress instance to send emails, in my case I used the plugin wp-smtp mail.
- Send a link to an authenticated admin user, when the user opens the link, the forum role of the new user is "Keymaster".
Recommendations
Implement CSRF Protection
Impact
While the compromised user remains a WordPress subscriber and does not obtain full site-wide administrative privileges, the bbp_keymaster role grants complete control over the bbPress forum, including managing topics, users, and settings, an attacker could modify discussions, delete content, or manipulate user roles within bbPress.
Context
bbPress is the forum plugin for WordPress. Among the roles it defines for forum participants is bbp_keymaster, the highest forum role, which controls forum topics, users and settings. The report looks at what happens when a new user registers on a site running bbPress: the plugin assigns that user a forum role, and the assignment is driven by a POST parameter that the registering request controls.
The researcher's claim is that this role assignment lacks adequate CSRF protection, so an attacker can craft a request that registers a new account with attacker-chosen details and immediately gives it the bbp_keymaster forum role, without authenticating as that user or proving intent.
Setup
The preconditions are minimal:
- A WordPress installation with the bbPress plugin installed and activated.
- A WordPress instance configured to send email, so that registration emails are delivered. The researcher used the wp-smtp mail plugin for this.
- An authenticated admin user who can be persuaded to open a link.
The proof of concept targets a local WordPress installation at http://localhost/victim/, with the registration endpoint at wp-login.php.
Finding it
The researcher focused on bbp_user_add_role_on_register, the function that assigns a forum role when a user registers. That function takes the role from a user-controlled POST parameter, bbp-forums-role. Because the value comes from the request rather than from a fixed default or a server-side decision, a cross-site request that reaches the registration handler can set the role to any value the attacker chooses, including bbp_keymaster.
Exploitation
Step 1: Prepare the target
Install and activate the bbPress plugin on the WordPress instance, and configure the site so that it can send email.
Step 2: Build the CSRF form
The researcher's proof of concept is a self-submitting HTML page. It posts to the registration handler on the victim site and carries the attacker's chosen username, email address and forum role.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loading...</title>
</head>
<body onload="document.getElementById('csrf-form').submit();">
<form id="csrf-form" action="http://localhost/victim/wp-login.php" method="POST">
<input type="hidden" name="user_login" value="evilpen">
<input type="hidden" name="user_email" value="[redacted]">
<input type="hidden" name="action" value="register">
<input type="hidden" name="bbp-forums-role" value="bbp_keymaster">
</form>
</body>
</html>
The important parts:
action="http://localhost/victim/wp-login.php"andmethod="POST"send the request to WordPress's login and registration endpoint.action=registerselects the registration path.user_loginanduser_emailset the new account's username and email address to values the attacker controls.bbp-forums-role=bbp_keymasteris the parameter consumed bybbp_user_add_role_on_register; it requests the highest bbPress forum role for the new account.onload="document.getElementById('csrf-form').submit();"submits the form automatically as soon as the page loads, so the victim only has to open the link.
Step 3: Deliver the link
Send the link to an authenticated admin user. When the admin opens it, the form submits and a new user is registered with the attacker's details. The new account receives an email containing its login credentials.
Step 4: Observe the result
When the admin opens the link, the forum role of the newly registered user is Keymaster.
Root cause
bbp_user_add_role_on_register assigns a user role based on a user-controlled POST parameter, bbp-forums-role. The registration request therefore carries the role decision itself, and nothing in the flow ties that decision to the person who is supposed to be making it. A cross-site form can reproduce the registration request with an arbitrary role value, and the plugin applies it.
Impact
The compromised user remains a WordPress subscriber and does not obtain full site-wide administrative privileges. The impact is confined to bbPress: the bbp_keymaster role grants complete control over the forum, including managing topics, users and settings. An attacker holding that role could modify discussions, delete content, or manipulate user roles within bbPress.
Fix
The report's recommendation is to implement CSRF protection on the role assignment path, so that a registration request carrying a forum role cannot be forged from another site.
Variants to test
- Other role-bearing registration parameters. Look for other plugins that accept a role, group or permission parameter on the registration or profile-update request. A positive result is a forged cross-site request that creates or modifies an account with a role the attacker chose.
- Profile update endpoints. The same pattern can appear where an authenticated user updates their own profile and the request accepts a role field. A positive result is a role change applied from a cross-site form without a valid token.
- Registration with attacker-controlled email. Any registration flow that emails credentials to an address supplied in the request is worth testing, because it turns a forged registration into an account the attacker can actually log into. A positive result is a credential email arriving at the attacker's address after a victim triggers the request.
Hunting notes
This class of bug tends to hide in plugin code that reads a privilege-related value directly from $_POST or $_REQUEST during registration, profile updates or bulk actions, especially where the value is applied without a nonce check. During recon, registration and profile forms that expose role, group or capability fields are the signal to follow: submit one with a modified value and see whether the server honours it, then check whether the same request succeeds cross-site without a token.
To show impact, the researcher demonstrated the chain: a self-submitting form, an admin who opens it, a new account created with attacker-chosen details, and the resulting forum role observed as Keymaster. The report is explicit about the limit as well: the account stays a WordPress subscriber, and the elevated control is scoped to bbPress rather than the whole site.
What happened, in plain words
A website can be built from pieces called plugins, which are add-ons that give it extra features. bbPress is one such plugin for WordPress (a popular system for making websites and blogs). bbPress adds a discussion forum to a WordPress site, where people can post topics and reply to each other.
Inside a forum, different people are allowed to do different things. bbPress uses roles for this. The most powerful forum role is called bbp_keymaster. Someone with that role can manage topics, manage users and change forum settings. It is the boss role of the forum, though not the boss role of the whole WordPress site.
When a new person signs up on a site running bbPress, the plugin decides which forum role that person gets. The researcher found that this decision is not made safely. The sign-up request itself can carry a value saying which role the new account should have, and the plugin simply trusts it. That is the bug.
The kind of bug is called CSRF, short for Cross-Site Request Forgery. To understand it, imagine a signed permission slip. A website trusts requests that arrive with the right slip attached, because it assumes only the real user could have the slip. CSRF is when an attacker tricks the user's own browser into sending a request with the slip attached, without the user meaning to. The website sees a valid slip and obeys, even though the user never intended the action.
In this case the attacker builds a small web page containing a hidden form, a page element that sends data to a website when submitted. The attacker sends the link to that page to an administrator of the victim site. When the admin opens the link, the admin's browser automatically submits the form to the victim site. A new account is created with details the attacker chose, and that account is given the bbp_keymaster role. The new account then receives an email with its login details, sent to the address supplied in the form. So a new account is created with the highest forum role, without the attacker logging in as anyone.
The researcher's own summary of the cause: the function bbp_user_add_role_on_register assigns a user role based on a user-controlled POST parameter called bbp-forums-role. A POST parameter is a piece of data sent along with a form submission. "User-controlled" means the person sending the request decides its value. Because the role comes from the request instead of from a fixed safe default, an attacker can put any role in it.
Context
bbPress is the forum plugin for WordPress. Among the roles it defines for forum participants is bbp_keymaster, the highest forum role, which controls forum topics, users and settings. The report looks at what happens when a new user registers on a site running bbPress: the plugin assigns that user a forum role, and the assignment is driven by a POST parameter that the registering request controls.
A few words first, since they come up throughout. A plugin is an add-on that extends a website platform with new features. WordPress is a platform for building websites; it handles user accounts, logins and content. bbPress is a WordPress plugin that adds a forum. A role is a named bundle of permissions: instead of granting each permission one by one, the site gives a person a role and the role decides what they may do. A POST parameter is a named value sent inside a form submission; the name and the value travel together, like a labelled box on a delivery.
The researcher's claim is that this role assignment lacks adequate CSRF protection, so an attacker can craft a request that registers a new account with attacker-chosen details and immediately gives it the bbp_keymaster forum role, without authenticating as that user or proving intent.
CSRF protection normally means a check that the request really came from the site's own pages and from a user who meant to act, typically a secret one-time value (a token) that the attacker's page cannot know. Authenticating means proving you are who you say you are, usually by logging in. Proving intent means the site has evidence the user actually chose to do this thing, rather than merely having a browser open.
Setup
The preconditions are minimal:
- A WordPress installation with the bbPress plugin installed and activated.
- A WordPress instance configured to send email, so that registration emails are delivered. The researcher used the wp-smtp mail plugin for this.
- An authenticated admin user who can be persuaded to open a link.
An installation here just means a working copy of WordPress on a server. Activated means the plugin is switched on and running. Configured to send email matters because WordPress normally sends sign-up emails through the server's own mail system, which often fails or lands in spam; a mail plugin such as wp-smtp mail routes those emails through a proper mail service so they actually arrive. The researcher needed this so the new account's credentials would be delivered. An authenticated admin user is someone logged in with administrator rights. The attacker does not need to break into that person's account; they only need that person to open a link while logged in.
The proof of concept targets a local WordPress installation at http://localhost/victim/, with the registration endpoint at wp-login.php.
Local means the site runs on the researcher's own computer rather than on the internet. localhost is the standard name a computer uses for itself. An endpoint is a specific address on a website that accepts a particular kind of request; wp-login.php is the WordPress file that handles logging in and, on sites that allow it, signing up.
Finding it
The researcher focused on bbp_user_add_role_on_register, the function that assigns a forum role when a user registers. That function takes the role from a user-controlled POST parameter, bbp-forums-role. Because the value comes from the request rather than from a fixed default or a server-side decision, a cross-site request that reaches the registration handler can set the role to any value the attacker chooses, including bbp_keymaster.
A function is a named block of code that does one job; here, the job is "add a role when someone registers". A fixed default would be a role the plugin picks itself, such as the lowest one, with no input from the request. A server-side decision means the server works out the answer from its own records rather than believing what the browser sends. The problem is the opposite: the browser sends the answer, and the server accepts it. A cross-site request is a request that originates from a different website than the one being targeted, which is exactly what an attacker's page produces.
Exploitation
Step 1: Prepare the target
Install and activate the bbPress plugin on the WordPress instance, and configure the site so that it can send email.
This step exists to recreate the conditions of a real victim site: a forum plugin that assigns roles on registration, and working email so the resulting account's credentials can be delivered. Without the plugin there is no vulnerable code; without email the registration email would not be delivered.
Step 2: Build the CSRF form
The researcher's proof of concept is a self-submitting HTML page. It posts to the registration handler on the victim site and carries the attacker's chosen username, email address and forum role.
HTML is the language web pages are written in. A form is the part of a page that collects values and sends them to a server. Self-submitting means the page sends the form by itself, with no button press from the visitor.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loading...</title>
</head>
<body onload="document.getElementById('csrf-form').submit();">
<form id="csrf-form" action="http://localhost/victim/wp-login.php" method="POST">
<input type="hidden" name="user_login" value="evilpen">
<input type="hidden" name="user_email" value="[redacted]">
<input type="hidden" name="action" value="register">
<input type="hidden" name="bbp-forums-role" value="bbp_keymaster">
</form>
</body>
</html>
Line by line, in plain words:
<!DOCTYPE html>tells the browser this file is an HTML page.<html lang="en">opens the page and says its language is English.<head>starts the section that holds information about the page rather than visible content.<meta charset="UTF-8">says which character encoding the page uses, so text displays correctly.<meta name="viewport" ...>tells mobile browsers how to scale the page.<title>Loading...</title>sets the text shown in the browser tab. It says "Loading..." so the visitor sees something harmless while the form submits.</head>closes that section.<body onload="document.getElementById('csrf-form').submit();">opens the visible part of the page and attaches an instruction to the moment the page finishes loading.onloadmeans "when this page has loaded".document.getElementById('csrf-form')finds the form whose id iscsrf-form..submit()sends it. So the form is sent automatically the instant the page opens.<form id="csrf-form" action="http://localhost/victim/wp-login.php" method="POST">starts the form.id="csrf-form"is the name used to find it.action="..."is the address the data is sent to: the victim site's login and registration file.method="POST"means the data travels in the body of the request rather than in the address bar.<input type="hidden" name="user_login" value="evilpen">adds a field the visitor cannot see. Its name isuser_loginand its value isevilpen, the username the attacker wants for the new account.<input type="hidden" name="user_email" value="[redacted]">sets the new account's email address to one the attacker controls. This is the key to receiving the login credentials.<input type="hidden" name="action" value="register">tells WordPress which action to perform: register a new user.<input type="hidden" name="bbp-forums-role" value="bbp_keymaster">is the heart of the attack. It asks bbPress to give the new account the highest forum role.</form>closes the form.</body>and</html>close the page.
The important parts:
action="http://localhost/victim/wp-login.php"andmethod="POST"send the request to WordPress's login and registration endpoint.action=registerselects the registration path.user_loginanduser_emailset the new account's username and email address to values the attacker controls.bbp-forums-role=bbp_keymasteris the parameter consumed bybbp_user_add_role_on_register; it requests the highest bbPress forum role for the new account.onload="document.getElementById('csrf-form').submit();"submits the form automatically as soon as the page loads, so the victim only has to open the link.
Step 3: Deliver the link
Send the link to an authenticated admin user. When the admin opens it, the form submits and a new user is registered with the attacker's details. The new account receives an email containing its login credentials, which the attacker controls through the email address in the form.
The attacker never sees or steals that login; they simply borrow the browser's habit of attaching it to requests. The missing piece is a check that the admin actually meant to register this account, which is what CSRF protection would provide.
Step 4: Observe the result
When the admin opens the link, the forum role of the newly registered user is Keymaster.
This is the confirmation: the account exists and its forum role is the highest one in the forum.
Root cause
bbp_user_add_role_on_register assigns a user role based on a user-controlled POST parameter, bbp-forums-role. The registration request therefore carries the role decision itself, and nothing in the flow ties that decision to the person who is supposed to be making it. A cross-site form can reproduce the registration request with an arbitrary role value, and the plugin applies it.
Put simply: the plugin asks the visitor "which role should this account have?" and believes the answer. A safe design would never ask that question of the visitor at all, or would require proof that the request came from the site's own pages and from a user who intended it.
Impact
The compromised user remains a WordPress subscriber and does not obtain full site-wide administrative privileges. The impact is confined to bbPress: the bbp_keymaster role grants complete control over the forum, including managing topics, users and settings. An attacker holding that role could modify discussions, delete content, or manipulate user roles within bbPress.
A subscriber is the lowest standard WordPress role: someone who can log in and manage their own profile, nothing more. So the attacker does not gain control of the whole website, its pages or its other users. What they gain is the forum: they can change discussions, remove content and adjust who may do what inside bbPress. On a site whose main purpose is its community forum, that is still a serious loss of control.
Fix
The report's recommendation is to implement CSRF protection on the role assignment path, so that a registration request carrying a forum role cannot be forged from another site.
In everyday terms: the site should require evidence that the request came from its own pages and from a user who meant it, and it should not let the request dictate a privileged role in the first place.
Variants to test
- Other role-bearing registration parameters. Look for other plugins that accept a role, group or permission parameter on the registration or profile-update request. A positive result is a forged cross-site request that creates or modifies an account with a role the attacker chose.
- Profile update endpoints. The same pattern can appear where an authenticated user updates their own profile and the request accepts a role field. A positive result is a role change applied from a cross-site form without a valid token.
- Registration with attacker-controlled email. Any registration flow that emails credentials to an address supplied in the request is worth testing, because it turns a forged registration into an account the attacker can actually log into. A positive result is a credential email arriving at the attacker's address after a victim triggers the request.
A token here is a secret value the site gives to its own pages and checks on each sensitive request; an attacker's page cannot guess it, so a request without it is rejected. A profile update endpoint is the address that handles changes to a user's own account details.
Hunting notes
This class of bug tends to hide in plugin code that reads a privilege-related value directly from $_POST or $_REQUEST during registration, profile updates or bulk actions, especially where the value is applied without a nonce check. During recon, registration and profile forms that expose role, group or capability fields are the signal to follow: submit one with a modified value and see whether the server honours it, then check whether the same request succeeds cross-site without a token.
$_POST and $_REQUEST are the places PHP (the programming language WordPress is written in) keeps values sent in a form submission; $_REQUEST also collects values from the address bar. A nonce is a one-time secret value attached to a form so the server can tell a genuine submission from a forged one. Recon means the early survey of a target to see what it is made of and where to look. Bulk actions are operations applied to many items at once, such as changing several users' roles together.
To show impact, the researcher demonstrated the chain: a self-submitting form, an admin who opens it, a new account created with attacker-chosen details, and the resulting forum role observed as Keymaster. The report is explicit about the limit as well: the account stays a WordPress subscriber, and the elevated control is scoped to bbPress rather than the whole site.
Glossary
- WordPress: a platform for building websites, handling accounts, logins and content.
- Plugin: an add-on that gives a website platform extra features.
- bbPress: a WordPress plugin that adds a discussion forum.
- Role: a named bundle of permissions that decides what a person may do.
- bbp_keymaster: the highest bbPress forum role, controlling forum topics, users and settings.
- Subscriber: the lowest standard WordPress role, able to log in and manage only their own profile.
- POST parameter: a named value sent inside a form submission.
- User-controlled: the person sending the request decides the value.
- Endpoint: a specific address on a website that accepts a particular kind of request.
- wp-login.php: the WordPress file that handles logging in and, where allowed, signing up.
- Function: a named block of code that performs one job.
- bbp_user_add_role_on_register: the bbPress function that assigns a forum role when a user registers.
- bbp-forums-role: the POST parameter from which that function takes the role.
- CSRF (Cross-Site Request Forgery): tricking a logged-in user's browser into sending a request the user did not intend, so the site acts on the user's authority.
- CSRF protection: a check, usually a secret token, proving a request came from the site's own pages and from a user who meant it.
- Token: a secret value the site gives to its own pages and checks on sensitive requests, which an attacker's page cannot know.
- Nonce: a one-time secret value attached to a form so the server can tell a genuine submission from a forged one.
- Authenticating: proving you are who you say you are, usually by logging in.
- Authenticated admin user: someone logged in with administrator rights.
- Proving intent: the site having evidence the user actually chose an action.
- Cross-site request: a request that originates from a different website than the one being targeted.
- HTML: the language web pages are written in.
- Form: the part of a page that collects values and sends them to a server.
- Self-submitting: a page that sends its form automatically, with no button press.
- onload: a browser event meaning the page has finished loading.
- Hidden field: a form field the visitor cannot see but which is still sent.
- Local / localhost: running on the researcher's own computer;
localhostis the name a computer uses for itself. - Installation: a working copy of WordPress on a server.
- Activated: a plugin is switched on and running.
- Fixed default: a value the software picks itself, with no input from the request.
- Server-side decision: the server works out the answer from its own records rather than believing the browser.
- $_POST / $_REQUEST: PHP's storage for values sent in a form submission;
$_REQUESTalso collects values from the address bar. - PHP: the programming language WordPress is written in.
- Recon: the early survey of a target to see what it is made of and where to look.
- Bulk actions: operations applied to many items at once, such as changing several users' roles together.
- Profile update endpoint: the address that handles changes to a user's own account details.