CVE-2023-49293: Vite XSS vulnerability in server.transformIndexHtml via URL payload

CVE-2023-49293 · Severity: low · CVSS 3.1 · Published 2023-12-05

Vite is a build tool and development server for JavaScript applications. When Vite's HTML transformation function is called manually with an unmodified request URL containing inline scripts, attackers can inject arbitrary JavaScript into the page by crafting a malicious URL. This vulnerability primarily affects development servers using custom app types and requires a user to click a specially crafted link, but could lead to account compromise or unauthorized actions in dev environments.

Technologies: Vite. Vendors: Vite.

Quick answers

Is CVE-2023-49293 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2023-49293 being exploited in the wild.
How severe is CVE-2023-49293?
Low severity, with a CVSS score of 3.1, published 5 December 2023.
Which products and versions are affected?
Vite >=4.4.0 <4.4.12, 4.5.0, >=5.0.0 <5.0.5.
Is there a fix for CVE-2023-49293?
A patch was published on 2023-12-05: Fixed in vite@4.4.12, vite@4.5.1, vite@5.0.5 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2023-49293 attacked?
It is attacked over the network.
Am I affected by CVE-2023-49293?
Check whether you run Vite at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

This is a reflected XSS vulnerability (CWE-79) in Vite's HTML transformation pipeline. When `server.transformIndexHtml` is called with an unmodified request URL (as documented in SSR guides) and the HTML contains inline module scripts, Vite transforms these scripts into proxy script tags with dynamically generated paths. An attacker can break out of the script src attribute by injecting a malicious URL query string (e.g., `?"%3E%3C/script%3E%3Cscript%3Ealert('boom')</script>`), causing arbitrary HTML/JavaScript to be injected into the transformed output. The vulnerability affects apps using `appType: 'custom'` with the default Vite HTML middleware and requires user interaction (clicking a malicious link). Patched in vite 4.4.12, 4.5.1, and 5.0.5.

Affected products

  • Vite Vite >=4.4.0 <4.4.12, 4.5.0, >=5.0.0 <5.0.5

Identifiers

  • CVE-2023-49293
  • GHSA-92r3-m2mg-pj97

Timeline

  • 2023-12-04: disclosed
  • 2023-12-05: patched: Fixed in vite@4.4.12, vite@4.5.1, vite@5.0.5

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.