Cross-Site Scripting (XSS) Affecting vite package, versions >=4.4.0-beta.2 <4.4.12>=4.5.0 <4.5.1>=5.0.0-beta.0 <5.0.5


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.05% (23rd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Cross-Site Scripting (XSS) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-VITE-6098386
  • published5 Dec 2023
  • disclosed5 Dec 2023
  • creditMax Kukartsev

Introduced: 5 Dec 2023

CVE-2023-49293  (opens in a new tab)
CWE-79  (opens in a new tab)

How to fix?

Upgrade vite to version 4.4.12, 4.5.1, 5.0.5 or higher.

Overview

vite is a Native-ESM powered web dev build tool

Affected versions of this package are vulnerable to Cross-Site Scripting (XSS) when the HTML transformation function is invoked manually through server.transformIndexHtml. The original request URL is passed in unmodified. If the html being transformed contains inline module scripts, it is possible to inject arbitrary HTML into the transformed output by supplying a malicious URL query string to server.transformIndexHtml.

This is exploitable by convincing a user running a dev server with appType: 'custom' set and the default HTML middleware, to follow a malicious link. Additionally, restricted files aren't exposed to the attacker.

PoC

http://localhost:5173/?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E

CVSS Scores

version 3.1