/

CVE-2026-120539

Severity:

CRITICAL RISK

(9.8)

PHP Code Injection (CWE-95) in BuddyPress Restrictions

CVE-2026-120539

Deferred

Vulnerability type

Category:

PHP Code Injection

CWE:

CWE-95

Impact:

Unauthenticated Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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.

Sources

SourceLink
github.comgithub.com/seventhqueen/buddypress-restrict/releases/tag/1.5.5
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/bp-restrict/tags/1.5.4/admin/class-bp-restrict-admin.php#L213
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/bp-restrict/tags/1.5.4/admin/class-bp-restrict-pmpro.php#L184
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/bp-restrict/tags/1.5.4/admin/class-bp-restrict-pmpro.php#L187
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/bp-restrict/tags/1.5.4/includes/class-bp-restrict.php#L172
plugins.trac.wordpress.orgplugins.trac.wordpress.org/browser/bp-restrict/tags/1.5.4/includes/class-bp-restrict.php#L210
wordfence.comwordfence.com/threat-intel/vulnerabilities/id/fab68c0b-2211-4cc4-a112-f0011f9d72ed?source=cve

Frequently asked

questions

Yes. The described vulnerable path can be triggered by an unauthenticated GET request when the required plugins are active.

No account is required; the attacker needs to reach the affected WordPress site and its vulnerable request-handling path.

Avoid evaluating expressions built from request data. Replace dynamic evaluation with explicit logic and strict input handling.

Treat all request data as untrusted, prohibit or tightly control dynamic evaluation through code review and CI policies, and use least-privilege runtime permissions.

Find out what's already
exploitable in your codebase.