Skip to content

CVE-2023-49293 Cross-site Scripting in `server.transformIndexHtml` via URL payload in vite

MediumCVSS 6.1 EPSS 1.1% Scanner template
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: partial

Description

Vite is a website frontend framework. When Vite's HTML transformation is invoked manually via server.transformIndexHtml, the original request URL is passed in unmodified, and the html being transformed contains inline module scripts (<script type="module">...</script>), it is possible to inject arbitrary HTML into the transformed output by supplying a malicious URL query string to server.transformIndexHtml. Only apps using appType: 'custom' and using the default Vite HTML middleware are affected. The HTML entry must also contain an inline script. The attack requires a user to click on a malicious URL while running the dev server. Restricted files aren't exposed to the attacker. This issue has been addressed in vite@5.0.5, vite@4.5.1, and vite@4.4.12. There are no known workarounds for this vulnerability.

Upgrade path

2 packages: 2 fixed.

PackageAffectedFixed inStatus
npm vite(npm) = 4.5.0; >= 4.4.0, < 4.4.12; >= 4.5.0, < 4.5.1; >= 5.0.0, < 5.0.5 4.4.12, 4.5.1, 5.0.5 Fixed
vitejs vite = 5.0.0; = 5.0.0-beta0; = 5.0.0-beta1; = 5.0.0-beta2 +23 more after 4.4.11, 5.0.4 Fixed

Affected products

ProductAffected versionsFixed in
npm vite(npm) >= 4.4.0, < 4.4.12 4.4.12
npm vite(npm) = 4.5.0 No fix listed
npm vite(npm) >= 5.0.0, < 5.0.5 5.0.5
vitejs vite = >=4.4.0, < 4.4.12 No fix listed
vitejs vite = = 4.5.0 No fix listed
vitejs vite = >=5.0.0, < 5.0.5 No fix listed
vitejs vite >= 4.4.0, <= 4.4.11 No fix listed
vitejs vite >= 5.0.0, <= 5.0.4 No fix listed
vitejs vite = 5.0.0 No fix listed
vitejs vite = 5.0.0-beta0 No fix listed
vitejs vite = 5.0.0-beta1 No fix listed
vitejs vite = 5.0.0-beta10 No fix listed
vitejs vite = 5.0.0-beta11 No fix listed
vitejs vite = 5.0.0-beta12 No fix listed
vitejs vite = 5.0.0-beta13 No fix listed
vitejs vite = 5.0.0-beta14 No fix listed
vitejs vite = 5.0.0-beta15 No fix listed
vitejs vite = 5.0.0-beta16 No fix listed
vitejs vite = 5.0.0-beta17 No fix listed
vitejs vite = 5.0.0-beta18 No fix listed
vitejs vite = 5.0.0-beta19 No fix listed
vitejs vite = 5.0.0-beta2 No fix listed
vitejs vite = 5.0.0-beta20 No fix listed
vitejs vite = 5.0.0-beta3 No fix listed
vitejs vite = 5.0.0-beta4 No fix listed
Show 6 more
ProductAffected versionsFixed in
vitejs vite = 5.0.0-beta5 No fix listed
vitejs vite = 5.0.0-beta6 No fix listed
vitejs vite = 5.0.0-beta7 No fix listed
vitejs vite = 5.0.0-beta8 No fix listed
vitejs vite = 5.0.0-beta9 No fix listed
npm vite(npm) >= 4.5.0, < 4.5.1 4.5.1

References