CVE-2023-49293
Cross-site Scripting in `server.transformIndexHtml` via URL payload in vite
Record summary
CVE-2023-49293 has a selected CVSS score of 6.1 (medium); EIP currently links 1 Nuclei template.
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.
Exploitation context
Available material
- Nuclei templates
- 1
CISA SSVC decision
CISA Coordinator · SSVC 2.0.3 · Evaluated May 29, 2025 · Source: CVE List
Affected products and versions
2| Product | Source | Version range | Status |
|---|---|---|---|
| CVE List | >=4.4.0, < 4.4.12 | affected | |
| = 4.5.0 | affected | ||
| >=5.0.0, < 5.0.5 | affected | ||
| GitHub Advisory | 4.4.0 to < 4.4.12 · Fixed in 4.4.12 | affected | |
| 4.5.0 | affected | ||
| 4.5.0 to < 4.5.1 · Fixed in 4.5.1 | affected | ||
| 5.0.0 to < 5.0.5 · Fixed in 5.0.5 | affected |
Nuclei templates
1ProjectDiscoveryMEDIUMVite dev server - Cross-Site ScriptingCVSS 6.1
Vite's dev server, when used with `appType: 'custom'` and manually invoking `server.transformIndexHtml` using the unmodified request URL, is vulnerable to XSS via a crafted URL payload. If the HTML being served includes an inline module script (`<script type="module">...</script>`), an attacker can inject a script via the URL, potentially leading to XSS in the browser. The vulnerability only affects certain custom SSR/dev configurations, not plain `vite dev`.
Impact
Attackers can inject malicious HTML into the page, potentially leading to cross-site scripting or other client-side attacks.
Remediation
Update to vite@5.0.5, vite@4.5.1, or vite@4.4.12.
Source: ProjectDiscovery