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

    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 ID SNYK-JS-VITE-6098386
  • published 5 Dec 2023
  • disclosed 5 Dec 2023
  • credit Max Kukartsev

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
Expand this section

Snyk

Recommended
6.1 medium
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    Required
  • Scope (S)
    Changed
  • Confidentiality (C)
    Low
  • Integrity (I)
    Low
  • Availability (A)
    None
Expand this section

NVD

6.1 medium