Summary
The Restrictions for BuddyPress plugin for WordPress has a PHP code injection vulnerability caused by evaluating an expression containing attacker-controlled request data. An unauthenticated attacker may be able to execute arbitrary code on the server with a GET request when the plugin and its required companion plugins are active.
Affected context
The vulnerability affects the Restrictions for BuddyPress plugin in versions up to and including 1.5.4. The risky code path is enabled by default and is evaluated before the plugin checks whether a visitor is logged in. Exploitation applies when BuddyPress and Paid Memberships Pro are also active.
Exploit preconditions
- Attack surface: A WordPress site running the affected plugin.
- Required access: No authentication is required.
- Trigger point: A GET request whose URI is processed by the vulnerable code.
- Required conditions: BuddyPress and Paid Memberships Pro must be active alongside the plugin.
- Why exploitation is possible: Attacker-controlled URI data is interpolated into a PHP expression evaluated with
eval().
Why this happens
The plugin incorporates request URI data into a double-quoted PHP string and evaluates the resulting expression. PHP interpolation can interpret attacker-controlled content during evaluation, making this an improper neutralization of dynamically evaluated code, classified as CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code. Input slashing does not prevent this interpolation behavior.
Potential impact
- An attacker could execute arbitrary code on the web server.
- The attacker may gain access to data or resources available to the WordPress process.
- The site could be altered, disrupted, or used as a foothold for further compromise.
General mitigation guidance
Mitigation patterns include removing evaluation of request-derived data and replacing dynamic expressions with explicit, non-evaluating logic. Treat request URIs as untrusted, validate them against narrowly defined formats, and avoid relying on escaping or slashing as a substitute for eliminating evaluation. Keep exposed components and plugin combinations to those required by the site, and run the WordPress process with least privilege to limit potential impact.
How teams detect issues like this
- Use static analysis to identify
eval()and other dynamic code execution sinks that receive request-derived values. - Review code paths that interpolate URI or other request data into PHP strings, especially when evaluated before access checks.
- Use code review and CI policies to flag dynamic evaluation and require security review for exceptions.
- Monitor web-server and application logs for unusual requests and investigate unexpected server-side behavior.
Automated code review tools may help identify these patterns.

