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

vite Updated 02 Oct 2025

Summary

05/12/2023
Yes i
Moderate
6.1

CVE-2023-49293: Vite XSS vulnerability in server.transformIndexHtml via URL payload. Affects vite across 3 version ranges.

>= 4.4.0, < 4.4.12 >= 4.5.0, < 4.5.1 >= 5.0.0, < 5.0.5

Fixed in 4.4.12, 4.5.1 or 5.0.5, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Vite is an open-source build tool for modern web applications. It provides fast and efficient development and production builds, hot module replacement, and a rich plugin system. Vite is widely used in the JavaScript ecosystem for building frontend applications. However, a vulnerability has been discovered in Vite that allows for cross-site scripting (XSS) attacks when using the server.transformIndexHtml function.

Vulnerability Detail

The vulnerability arises when Vite's HTML transformation is manually invoked via server.transformIndexHtml and the html being transformed contains inline module scripts. In this scenario, if a malicious URL query string is supplied to server.transformIndexHtml, it is possible to inject arbitrary HTML into the transformed output. This can lead to XSS attacks, where an attacker can execute malicious scripts in the context of the affected user's browser. The impact of this vulnerability is limited to apps using appType: 'custom' and the default Vite HTML middleware, with the HTML entry containing an inline script. The attack requires a user to click on a malicious URL while running the dev server.

How To Fix

Latest published version: 8.3.5 as of 22 Oct 2026

npm install vite@8.3.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 4.4.0, < 4.4.12 4.4.12
    npm install vite@4.4.12
  • >= 4.5.0, < 4.5.1 4.5.1
    npm install vite@4.5.1
  • >= 5.0.0, < 5.0.5 5.0.5
    npm install vite@5.0.5

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If updating Vite is not immediately feasible, a workaround for this vulnerability is to avoid using server.transformIndexHtml with untrusted user input. It is important to sanitize and validate any user-supplied data before passing it to this function to prevent the injection of malicious HTML.

Conclusion

The Vite XSS vulnerability in server.transformIndexHtml poses a risk to applications using Vite's HTML transformation functionality. It is crucial to update to the fixed versions of Vite or apply the recommended workaround to mitigate the risk of XSS attacks. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for vite →

Share this vulnerability

FAQ

Vite versions 4.4.0-beta.2 and higher, including 4.4.0, are vulnerable to this XSS vulnerability.

The impact is limited to apps using appType: 'custom' and the default Vite HTML middleware, with the HTML entry containing an inline script. The attack requires a user to click on a malicious URL while running the dev server.

No, this vulnerability only affects development builds when using the Vite dev server.

There is no known public exploit for this vulnerability at the time of this report.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just the package-lock.json file.

Related vulnerabilities

Recent vulnerabilities recorded for vite.

How To Fix

Latest published version: 8.3.5 as of 22 Oct 2026

npm install vite@8.3.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 4.4.0, < 4.4.12 4.4.12
    npm install vite@4.4.12
  • >= 4.5.0, < 4.5.1 4.5.1
    npm install vite@4.5.1
  • >= 5.0.0, < 5.0.5 5.0.5
    npm install vite@5.0.5

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback