Critical, CVSS 9.8npmAmendedPublished
external-svg-loader Cross-site Scripting vulnerability
CVE-2023-40013 · GHSA-xc2r-jf2x-gjr8
- Affected
- npm external-svg-loader < 1.6.9
- Fixed in
- 1.6.9· Vendor fix available
- Issue
- According to the docs, svg-loader will strip all JS code before injecting the SVG file for security reasons but the input sanitization logic is not sufficient and can be trivially bypassed. This allows an attacker to craft a malicious SVG which can result in XSS. Details When trying to sanitize the svg the lib removes event attributes such as onmouseover, onclick but the list of events is not exhaustive. Here's a list of events not removed by svg-loader. onafterscriptexecute, onbeforecopy, onbeforecut, onbeforescriptexecute, onbeforetoggle, onbegin, onbounce, onend, onfinish, onfocusin, onfocusout, onmousewheel, onpointerrawupdate, onrepeat, onsearch, onshow, onstart, ontoggle(popover), ontouchend, ontouchmove, ontouchstart As you can see in the POC we can use onbegin in animate tag to execute JS code without needing to add data-js="enabled". PoC Impact Any website which uses external-svg-loader and allows its users to provide svg src, upload svg files would be susceptible to…
Recommended action: Upgrade to 1.6.9 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.