Automated Threat Modeling

Brief Summary: rtMedia CVE-2026-128102 Unauthenticated SQL Injection via custom_fields, with Patch Analysis

A brief summary of CVE-2026-128102, an unauthenticated SQL injection in the rtMedia plugin for WordPress through version 4.7.17, reachable through a publicly exposed upload nonce. Includes a short review of the 4.7.18 patch to the meta_id query-rewriting filter.

CVE Analysis

8 min read

Gaurav Sarraf
Gaurav Sarraf

2026-11-20

Brief Summary: rtMedia CVE-2026-128102 Unauthenticated SQL Injection via custom_fields, with Patch Analysis

Introduction

Any anonymous visitor to a WordPress site running rtMedia 4.7.17 or earlier could reach a SQL injection in the plugin's media upload path, using a nonce that the plugin itself hands out on every front-end page. The disclosed impact is loss of database confidentiality, which on community sites built around BuddyPress and bbPress means user and site data stored alongside the media tables.

rtMedia for WordPress, BuddyPress and bbPress is a media plugin authored by rtCamp that adds photo, video and audio handling to WordPress and BuddyPress sites. It has been listed on WordPress.org since August 6, 2012 and was last modified on November 17, 2026. The sources we reviewed do not establish its install count or market share. It matters because of where it runs: inside social and forum-style WordPress deployments, where it processes uploads from site members and, as this CVE shows, from unauthenticated visitors.

Technical information

Wordfence rates CVE-2026-128102 as High, 7.5 under CVSS 3.1, with the vector components AV:N, AC:L, PR:N, UI:N and confidentiality High, integrity None, availability None. It is classified as CWE-89, improper neutralization of special elements in an SQL command. The vulnerable input is the custom_fields parameter, and the advisory attributes the flaw to insufficient escaping of that value combined with insufficient preparation of the existing SQL query.

Why unauthenticated access is possible

The upload endpoint's only access control is a nonce check. The rtmedia_upload_nonce value is localized to every visitor, including unauthenticated ones, on every front-end page through wp_enqueue_scripts. A WordPress nonce served this way proves nothing about who the requester is, so the upload path is effectively open to anyone who can load a page on the site.

Root cause: rewriting already-escaped SQL

rtMedia keeps media metadata in its own table, whose primary key is id. The WordPress metadata API (get_metadata(), update_metadata() and related functions) builds SQL that expects a column named meta_id. To bridge that gap, rtMedia hooks the query and renames meta_id to id inside SQL that has already been built. At that point user-supplied values are already escaped and wrapped in single quotes, so any rewrite must leave those quoted values exactly as they are.

The rewrite lives in rtm_filter_metaid_column_name() in the plugin's template functions file (around line 3892 in 4.7.17). The vulnerable implementation in 4.7.17 and earlier:

$quoted_regex = "/'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/s"; 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;

The function works in three steps:

  1. Find every quoted value and replace it with the placeholder __QUOTE__.
  2. Run a plain str_replace() to change meta_id to id in what remains.
  3. Restore the original values one at a time, each time using strpos() to locate the first remaining __QUOTE__ and splicing the next saved value into it.

Step 3 assumes that every __QUOTE__ in the query was inserted by the function itself and that placeholders will be consumed in order. The restored values, however, are user data, including custom_fields values that reach media meta queries. If a value contains the literal text __QUOTE__, then once it is restored the next strpos() call finds the placeholder inside that value, and the next saved value is spliced into the middle of the previous one rather than into its own slot. Values land in the wrong positions, the quote boundaries produced by escaping no longer line up, and text that was meant to remain inside a string literal can be parsed as SQL. The upstream fix commit is titled "fix(query): rename meta_id column without masking quoted strings", which names this placeholder round trip as the defect.

The advisory also references the upload endpoint (RTMediaUploadEndpoint.php L85), the upload model (RTMediaUploadModel.php L49), the media controller (RTMediaMedia.php L149) and a second location in the template functions file at L2468. Together these form the path from the upload request to the media meta query.

Attack flow

Based on the advisory and the patch analysis, the attack proceeds as follows (no payload is reproduced here):

  1. The attacker loads any front-end page of the target site without logging in and reads the rtmedia_upload_nonce value localized through wp_enqueue_scripts.
  2. The attacker sends a request to the rtMedia upload endpoint, passing the nonce check with that value and supplying a crafted custom_fields parameter.
  3. The custom_fields value flows into media meta queries, where WordPress escapes and quotes it as part of normal query construction.
  4. rtm_filter_metaid_column_name() rewrites the finished query. A value containing the __QUOTE__ marker causes the restore loop to misplace quoted values, breaking the quote boundaries.
  5. Attacker-controlled text is now interpreted as SQL, allowing additional SQL to be appended to the existing query and used to extract sensitive information from the database.

Patch information

The flaw is fixed in rtMedia 4.7.18, released on November 16, 2026. Wordfence lists 4.7.18 as the patched version for every release up to and including 4.7.17. The changelog states only that the release "Hardened the query filter that renames the meta_id column for the media meta table", and the upgrade notice refers to security improvements to the media upload queries. Version 4.7.19 followed on November 19, 2026 with an unrelated escaping fix for gallery titles, so 4.7.19 and later also include this patch.

The fix trail:

  • Upstream commit 395b144, "fix(query): rename meta_id column without masking quoted strings"
  • Merged through PR #2394
  • Released in 4.7.18 through PR #2396
  • Pushed to WordPress.org SVN as changeset 3806726

A comparison of the 4.7.17 and 4.7.18 tags shows this is the only code change. Everything else is version bumps, changelog text and .pot line number updates. The entire fix is in rtm_filter_metaid_column_name():

// 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 ); return null === $rewritten ? $q : $rewritten;

The three-step process becomes a single pass. The pattern matches either a complete quoted value or the bare word meta_id:

  • Quoted values are consumed whole. The regex engine scans left to right and tries the quoted-value branch first, so a meta_id inside quotes is never matched on its own. The callback returns quoted values unchanged via $matches[0], and only a meta_id outside quotes becomes id.
  • Nothing is removed and reinserted. With no placeholder and no restore loop, there is nothing for user data to collide with. The definition of a quoted value, including backslash-escaped characters, is unchanged. Quoted values never move.
  • Safe fallback on regex failure. preg_replace_callback() returns null if the regex engine fails, for example on hitting its backtracking limit with very large input. The null === $rewritten ? $q : $rewritten check returns the original, already-escaped query instead of an empty or broken one. The worst case is that the column is not renamed and the query fails. User data is not exposed.

What the patch does not change. The diff leaves RTMediaUploadEndpoint.php, RTMediaUploadModel.php and RTMediaMedia.php untouched, and it does not change how rtmedia_upload_nonce is exposed to unauthenticated visitors. Anyone can still reach the upload path and submit custom_fields. Protection comes entirely from fixing the point where SQL is rewritten, which has the benefit of covering every query passing through this filter, not only uploads.

Affected systems and versions

  • Affected: rtMedia for WordPress, BuddyPress and bbPress (WordPress.org slug buddypress_media style listing at wordpress.org/plugins/buddypress-media), all versions up to and including 4.7.17.
  • Fixed: 4.7.18 (released November 16, 2026) and later, including 4.7.19 (released November 19, 2026).
  • Vulnerable configuration: any WordPress site with an affected rtMedia version active. Because rtmedia_upload_nonce is localized to every front-end page via wp_enqueue_scripts, no account or special site configuration is required for an attacker to reach the upload endpoint.

Vendor security history

This is not the first 2026 advisory for rtMedia. Examples from Wordfence records (not a complete audit):

  • CVE-2026-66592: unauthenticated SQL injection affecting versions up to 4.7.11, published August 19, 2026. Wordfence lists 4.7.12 as patched.
  • CVE-2026-89301: missing authorization leading to unauthenticated limited file read/disclosure and limited file deletion via sideload through the files[tmp_name] parameter, affecting versions up to 4.7.13, published October 9, 2026. That record also describes a publicly obtainable upload nonce. The excerpt we reviewed does not establish a fixed version.
  • CVE-2026-128102: unauthenticated SQL injection via custom_fields, affecting versions up to 4.7.17, published by Wordfence November 19, 2026, and patched in 4.7.18.

These records show a recurring pattern of unauthenticated SQL injection and upload-related access control issues within a few months. They do not, on their own, establish the overall quality of rtCamp's security program or its response times. The 4.7.18 patch fixes the SQL rewriting flaw but leaves the publicly exposed upload nonce in place, the same exposure described in the CVE-2026-89301 record.

The reviewed sources do not identify a threat actor, campaign, public exploit or in-the-wild exploitation for CVE-2026-128102, so its exploitation status is unknown rather than confirmed absent. NVD shows the Wordfence CNA score and notes that NIST has not provided its own assessment, and no CISA KEV listing was verified.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization