vite@2.0.0-beta.65

Native-ESM powered web dev build tool

  • latest version

    8.3.8

  • latest non vulnerable version

  • first published

    6 years ago

  • latest version published

    8 days ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the vite package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • L
    Cross-site Scripting (XSS)

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the getHtmlFilename function in packages/vite/src/node/server/middlewares/indexHtml.ts, where query strings are not stripped from the URL before the filename is constructed and passed to transformIndexHtml. An attacker who can influence the URL of an HTML request can supply a URL containing query parameters or a protocol-relative path (starting with //), causing the filename passed to transform hooks to be incorrect and potentially allowing unintended resource resolution or URL manipulation in generated script and link tags.

    How to fix Cross-site Scripting (XSS)?

    Upgrade vite to version 8.3.3, 8.2.4, 8.1.6, 7.3.7, 6.4.4 or higher.

    >=8.3.0 <8.3.3>=8.2.0 <8.2.4>=8.0.0 <8.1.6>=7.0.0 <7.3.7<6.4.4
    • M
    Directory Traversal

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Directory Traversal via the importAnalysisPlugin in packages/vite/src/node/plugins/importAnalysis.ts, where resolved module IDs are registered into safeModulePaths using the URL form (via fsPathFromUrl(stripBase(url, base))) rather than the cleaned filesystem path. A Vite plugin can return a resolveId result whose path, when processed through URL-to-path conversion, maps to a file outside the intended safe module set, causing that file to be incorrectly marked as safe and subsequently served via the @fs endpoint to any network requester. This allows an attacker to read files that should be blocked by the filesystem access restrictions.

    How to fix Directory Traversal?

    Upgrade vite to version 8.3.3, 8.2.4, 8.1.6, 7.3.7, 6.4.4 or higher.

    >=8.3.0 <8.3.3>=8.2.0 <8.2.4>=8.0.0 <8.1.6>=7.0.0 <7.3.7<6.4.4
    • M
    Command Injection

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Command Injection via constructWindowsLaunchCommand in packages/launch-editor/construct-windows-launch-command.js, where file path arguments containing % characters are passed unsanitized to childProcess.exec on Windows. CMD expands percent-delimited expressions such as %VAR:old=new% before consuming caret escapes, allowing an attacker who controls the file path argument to inject arbitrary OS commands through environment variable expansion. Arguments containing line breaks are similarly not rejected, as CMD treats line breaks as command separators.

    Note: This is only exploitable on Windows platforms.

    How to fix Command Injection?

    Upgrade vite to version 6.4.4, 7.3.7, 8.1.6, 8.2.4, 8.3.3 or higher.

    <6.4.4>=7.0.0 <7.3.7>=8.0.0 <8.1.6>=8.2.0 <8.2.4>=8.3.0 <8.3.3
    • H
    Arbitrary Command Injection

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Arbitrary Command Injection via the parseFile function in packages/launch-editor/index.js, which previously resolved file paths only after stripping position suffixes without calling path.resolve before security checks. An attacker who can influence the file argument passed to launchEditor can supply a path that bypasses the UNC path check on Windows (which compared the raw, unresolved string against \\\\) and cause the editor to open an arbitrary file on the host system, achieving unauthorized read and write access to sensitive files.

    How to fix Arbitrary Command Injection?

    Upgrade vite to version 6.4.4, 7.3.7, 8.1.6, 8.2.4, 8.3.3 or higher.

    <6.4.4>=7.0.0 <7.3.7>=8.0.0 <8.1.6>=8.2.0 <8.2.4>=8.3.0 <8.3.3
    • M
    Arbitrary Argument Injection

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Arbitrary Argument Injection via the getArgumentsForFile function in packages/launch-editor/get-args.js, where a filename is passed directly to an editor process without being resolved to an absolute path first. An attacker who can control the filename argument can supply a value beginning with a hyphen or flag-like prefix, causing it to be interpreted as a command-line flag by the spawned editor process rather than as a file path.

    Note: This is only exploitable on WSL (Windows Subsystem for Linux) environments where Vite 2.0.0+ is used with launch-editor-middleware v2.2.0+, and the impact on Notepad++ is limited to configurations using a plugin that exposes dangerous operations via plugin messages.

    How to fix Arbitrary Argument Injection?

    Upgrade vite to version 6.4.4, 7.3.7, 8.1.6, 8.2.4, 8.3.3 or higher.

    <6.4.4>=7.0.0 <7.3.7>=8.0.0 <8.1.6>=8.2.0 <8.2.4>=8.3.0 <8.3.3
    • H
    Directory Traversal

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Directory Traversal due to improper checks for file system paths on Windows platforms in isFileLoadingAllowed() function. An attacker can obtain sensitive file contents by bypassing path restrictions using NTFS alternate data streams or 8.3 short name compatibility features. This is only exploitable if the development server is explicitly exposed to the network, the sensitive file exists in the allowed directories, and the server is running on Windows with the file located on an NTFS volume or a volume with 8.3 short name generation enabled.

    How to fix Directory Traversal?

    Upgrade vite to version 6.4.3, 7.3.5, 8.0.16 or higher.

    <6.4.3>=7.0.0-beta.0 <7.3.5>=8.0.0-beta.0 <8.0.16
    • M
    Directory Traversal

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Directory Traversal via the handling of .map files in the dev server when resolving file paths. An attacker can access sensitive files outside the project root by injecting ../ segments into the URL, provided the files are valid source map JSON and the server is explicitly exposed to the network with predictable .map file paths.

    Note:

    This is only exploitable if the dev server is started with the --host flag or the server.host configuration option, and sensitive content exists in predictable .map files.

    How to fix Directory Traversal?

    Upgrade vite to version 6.4.2, 7.3.2, 8.0.5 or higher.

    <6.4.2>7.0.0 <7.3.2>8.0.0 <8.0.5
    • M
    Directory Traversal

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Directory Traversal via the server.fs.deny function. An attacker can access restricted files by appending a backslash to the URL when the development server is running on Windows and is explicitly exposed to the network.

    Note: This is only exploitable if the server is explicitly exposed to the network using the command line parameter --host or the config option server.host.

    How to fix Directory Traversal?

    Upgrade vite to version 5.4.21, 6.4.1, 7.0.8, 7.1.11 or higher.

    <5.4.21>=6.0.0 <6.4.1>=7.0.0 <7.0.8>=7.1.0 <7.1.11
    • L
    Relative Path Traversal

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Relative Path Traversal via improper enforcement of server.fs settings. An attacker can access arbitrary HTML files on the server by sending crafted requests to the preview server.

    Note: This is only exploitable if the server is explicitly exposed to the network using the --host flag or the server.host configuration option, and the application uses appType set to 'spa' (default) or 'mpa'.

    How to fix Relative Path Traversal?

    Upgrade vite to version 5.4.20, 6.3.6, 7.0.7, 7.1.5 or higher.

    <5.4.20>=6.0.0 <6.3.6>=7.0.0 <7.0.7>=7.1.0 <7.1.5
    • M
    Directory Traversal

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Directory Traversal through the server.fs.deny configuration due to improper input sanitization. An attacker can bypass server.fs.deny with /. for files under project root and access sensitive files by manipulating path traversal sequences.

    Note:

    This is only exploitable if the application is explicitly exposing the Vite dev server to the network (using --host or server.host config option). Only files that are under project root and are denied by a file matching pattern can be bypassed.

    How to fix Directory Traversal?

    Upgrade vite to version 4.5.14, 5.4.19, 6.1.6, 6.2.7, 6.3.4 or higher.

    <4.5.14>=5.0.0 <5.4.19>=6.0.0 <6.1.6>=6.2.0 <6.2.7>=6.3.0 <6.3.4
    • M
    Information Exposure

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Information Exposure due to the handling of req.url which may contain unexpected characters such as #. An attacker can access and retrieve the contents of arbitrary files by sending specially crafted requests that bypass the server.fs.deny checks.

    Note:

    This is only exploitable if the Vite dev server is explicitly exposed to the network and running on Node or Bun runtimes, excluding Deno.

    How to fix Information Exposure?

    Upgrade vite to version 4.5.13, 5.4.18, 6.0.15, 6.1.5, 6.2.6 or higher.

    <4.5.13>=5.0.0 <5.4.18>=6.0.0 <6.0.15>=6.1.0 <6.1.5>=6.2.0 <6.2.6
    • H
    Incorrect Authorization

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Incorrect Authorization via the bypass of the server.fs.deny restriction. An attacker can access restricted files by appending ?.svg with ?.wasm?init or with sec-fetch-dest: script header to the requests.

    Note:

    This is only exploitable if the file is smaller than the build.assetsInlineLimit (default: 4kB), when using Vite 6.0+ and when the Vite dev server is explicitly exposed to the network (using --host or server.host config option.

    How to fix Incorrect Authorization?

    Upgrade vite to version 4.5.12, 5.4.17, 6.0.14, 6.1.4, 6.2.5 or higher.

    <4.5.12>=5.0.0 <5.4.17>=6.0.0 <6.0.14>=6.1.0 <6.1.4>=6.2.0 <6.2.5
    • M
    Access Control Bypass

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Access Control Bypass through the server.fs.deny configuration, which is bypassed when using ?import query with inline and raw parameters. An attacker can read arbitrary files and return their content if they exist by crafting a URL that includes specific query parameters.

    How to fix Access Control Bypass?

    Upgrade vite to version 4.5.11, 5.4.16, 6.0.13, 6.1.3, 6.2.4 or higher.

    <4.5.11>=5.0.0 <5.4.16>=6.0.0 <6.0.13>=6.1.0 <6.1.3>=6.2.0 <6.2.4
    • H
    Incorrect Authorization

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Incorrect Authorization due to missing checks in transformMiddleware() which ignore certain query parameters. An attacker can access unauthorized files by including a ?raw?? or ?import&raw?? URL parameter. The allow list used by server.fs.deny() is not checked when handling these queries and the file contents are returned.

    Note: The dev server is configured by default to be inaccessible. This is only exploitable if the dev server is exposed to the network with either the --host command line option or server.host config option.

    How to fix Incorrect Authorization?

    Upgrade vite to version 4.5.10, 5.4.15, 6.0.12, 6.1.2, 6.2.3 or higher.

    <4.5.10>=5.0.0 <5.4.15>=6.0.0 <6.0.12>=6.1.0 <6.1.2>=6.2.0 <6.2.3
    • M
    Origin Validation Error

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Origin Validation Error due to default CORS settings and lack of validation on the Origin header for WebSocket connections, making any websites able to send any requests to the development server and read the response. An attacker can intercept and manipulate requests by sending crafted WebSocket requests from unauthorized origins.

    Note:

    Additionally to upgrading to a fixed version, the following configurations need to be made to fix the vulnerability:

    1. If the backend integration feature is used and server.origin is not set, the origin of the backend server needs to be added to the server.cors.origin option. Make sure to set a specific origin rather than *, otherwise any origin can access your development server;

    2. If a reverse proxy is used in front of Vite and requests are sent to Vite with a hostname other than localhost or *.localhost, the hostname needs to be added to the new server.allowedHosts option. For example, if the reverse proxy is sending requests to http://vite:5173, vite needs to be added to the server.allowedHosts option;

    3. If the development server is accessed via a domain other than localhost or *.localhost the hostname needs to be added to the new server.allowedHosts option. For example, if you are accessing the development server via http://foo.example.com:8080, you need to add foo.example.com to the server.allowedHosts option;

    4. If a plugin / framework is used that connects to the WebSocket server on their own from the browser and the WebSocket connection appears not to be working after upgrading to a fixed version, it is recommended to either fix the plugin / framework code to the make it compatible with the new version or to set legacy.skipWebSocketTokenCheck: true to opt-out the fix for "Lack of validation on the Origin header for WebSocket connections" while the plugin / framework is incompatible with the new version of Vite. When enabling this option, make sure that you are aware of the security implications of this vulnerability.

    How to fix Origin Validation Error?

    Upgrade vite to version 4.5.6, 5.4.12, 6.0.9 or higher.

    <4.5.6>=5.0.0 <5.4.12>=6.0.0 <6.0.9
    • M
    Information Exposure

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Information Exposure when using ?import&raw in the URL parameters. An attacker can access file contents that should be restricted by exploiting this bypass mechanism.

    How to fix Information Exposure?

    Upgrade vite to version 3.2.11, 4.5.5, 5.2.14, 5.3.6, 5.4.6 or higher.

    <3.2.11>=4.0.0 <4.5.5>=5.0.0 <5.2.14>=5.3.0 <5.3.6>=5.4.0 <5.4.6
    • L
    Cross-site Scripting (XSS)

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Cross-site Scripting (XSS) through the document.currentScript lookup mechanism when building scripts to cjs/iife/umd output format. This vulnerability is exploitable on websites that allow users to inject certain scriptless HTML tags without properly sanitizing the name or id attributes.

    How to fix Cross-site Scripting (XSS)?

    Upgrade vite to version 3.2.11, 4.5.5, 5.2.14, 5.3.6, 5.4.6 or higher.

    <3.2.11>=4.0.0 <4.5.5>=5.0.0 <5.2.14>=5.3.0 <5.3.6>=5.4.0 <5.4.6
    • H
    Path Equivalence

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Path Equivalence such that Server Options (server.fs.deny) can be bypassed using double forward-slash (//) allowing any unauthenticated user to read files from the Vite root-path of the application including the default fs.deny settings (['.env', '.env.*', '*.{crt,pem}']).

    Note:

    Only users explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected, and only files in the immediate Vite project root folder could be exposed.

    How to fix Path Equivalence?

    Upgrade vite to version 2.9.16, 3.2.7, 4.0.5, 4.1.5, 4.2.3, 4.3.9 or higher.

    <2.9.16>=3.0.0 <3.2.7>=4.0.0 <4.0.5>=4.1.0 <4.1.5>=4.2.0 <4.2.3>=4.3.0 <4.3.9
    • H
    Directory Traversal

    vite is a Native-ESM powered web dev build tool

    Affected versions of this package are vulnerable to Directory Traversal. It allows attackers to perform a directory traversal via a crafted URL to the victim's service.

    How to fix Directory Traversal?

    Upgrade vite to version 2.9.13 or higher.

    <2.9.13