# CVE-2023-40013: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in external-svg-loader

- Severity: High 7.1 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.56%, higher than 47% of CVEs (2026-12-01)
- Published: 2023-08-14T20:10:24.585Z
- Modified: 2026-09-10T03:50:03.021Z
- Also known as: GHSA-xc2r-jf2x-gjr8
- Weaknesses: CWE-79
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

## Description

SVG Loader is a javascript library that fetches SVGs using XMLHttpRequests and injects the SVG code in the tag's place. 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 Cross-site Scripting (XSS). When trying to sanitize the svg the lib removes event attributes such as `onmouseover`, `onclick` but the list of events is not exhaustive.  Any website which uses external-svg-loader and allows its users to provide svg src, upload svg files would be susceptible to stored XSS attack. This issue has been addressed in commit `d3562fc08` which is included in releases from 1.6.9. Users are advised to upgrade. There are no known workarounds for this vulnerability.

(As written by CVE List.)

## Affected

- shubhamjain svg-loader: < 1.6.9
- shubhamjain svg_loader: before 1.6.9
- external-svg-loader (npm): before 1.6.9

## Every score

- GitHub_M: CVSS:3.1 7.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L`
- GitHub: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 5.4 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N`

## References

- <https://github.com/shubhamjain/svg-loader/security/advisories/GHSA-xc2r-jf2x-gjr8> (vendor-advisory, web)
- <https://github.com/shubhamjain/svg-loader/commit/d3562fc08497aec5f33eb82017fa1417b3319e2c> (patch, web)
- <https://github.com/shubhamjain/svg-loader/blob/main/svg-loader.js#L125-L128> (product, web)
- <https://github.com/shubhamjain/svg-loader/tree/main#2-enable-javascript> (product, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2023-40013> (advisory)
- <https://github.com/shubhamjain/svg-loader> (package)

## Sources

- CVE List: [CVE-2023-40013](https://www.cve.org/CVERecord?id=CVE-2023-40013), CVE Terms of Use, modified 2024-10-02
- GitHub Advisory Database: [GHSA-xc2r-jf2x-gjr8](https://github.com/advisories/GHSA-xc2r-jf2x-gjr8), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2023-40013](https://nvd.nist.gov/vuln/detail/CVE-2023-40013), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2023-40013 · Whole record: https://cve.day/CVE-2023-40013.json · Rebuilt by cve.day 2026-11-25T22:58:27.119Z
