rhukster/dom-sanitizer: SVG tag allows CSS injection via unfiltered url() and @import directives
CVE-2026-40301 · GHSA-93vf-569f-22cq
- Affected
- Packagist rhukster/dom-sanitizer < 1.0.10
- Fixed in
- 1.0.10· Vendor fix available
- Issue
- 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 EXTERNALURL pattern — but text node content of <style elements is never examined. Because CSS rules live in text nodes, EXTERNALURL filtering never applies to them. Vulnerable code (src/DOMSanitizer.php, line 31): The following payload survives sanitize() intact: PoC 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…
Recommended action: Upgrade to 1.0.10 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.