# CVE-2022-35204: Vite before v2.9.13 vulnerable to directory traversal via crafted URL to victim's service

> Attackers can read arbitrary files from the victim's system via directory traversal in the Vite development server.

- **Severity:** Medium 4.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 18 Aug 2022
- **Updated:** 3 Aug 2024
- **Also known as:** GHSA-mv48-hcvh-8jj8

## What is CVE-2022-35204?

CVE-2022-35204 is a medium-severity path traversal vulnerability in n/a, published on 18 Aug 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Vitejs Vite before v2.9.13 was discovered to allow attackers to perform a directory traversal via a crafted URL to the victim's service.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2022-35204?

4 open source packages ship an affected version, including vite. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `vite` | npm | All versions | 2.9.13 |
| `vite` | npm | All versions | 2.9.13 |
| `vite` | npm | From 3.0.0-alpha.0 | 3.0.0-beta.4 |
| `vite` | npm | From 3.0.0-alpha.0 | 3.0.0-beta.4 |

Products: Vitejs Vite.

## How do I fix CVE-2022-35204?

Upgrade vite to a fixed version for your release line: 2.9.13 or 3.0.0-beta.4.

## Is CVE-2022-35204 being exploited?

There is no known exploitation of CVE-2022-35204 in the wild and no public exploit code.

## Other vulnerabilities in n/a

- [CVE-2025-31125](https://insights.sbomify.com/CVE-2025-31125/): Vite Vitejs Improper Access Control (medium 5.3, exploited in the wild)
- [CVE-2026-53571](https://insights.sbomify.com/CVE-2026-53571/): Vite: `server.fs.deny` bypass on Windows alternate paths (high 8.2)
- [CVE-2026-39363](https://insights.sbomify.com/CVE-2026-39363/): Vite Affected by Arbitrary File Read via Vite Dev Server WebSocket (high 8.2)
- [CVE-2026-39364](https://insights.sbomify.com/CVE-2026-39364/): Vite has a `server.fs.deny` bypass with queries (high 8.2)
- [CVE-2024-23331](https://insights.sbomify.com/CVE-2024-23331/): Vite dev server option `server.fs.deny` can be bypassed when hosted on case-insensitive filesystem (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-35204 and fix it if it is affected.

What it is: CVE-2022-35204 is a medium-severity path traversal vulnerability in n/a, published on 18 Aug 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-35204 in the wild and no public exploit code.

Affected packages and fixed versions:
- vite (npm): affected all versions; fixed in 2.9.13
- vite (npm): affected all versions; fixed in 2.9.13
- vite (npm): affected from 3.0.0-alpha.0; fixed in 3.0.0-beta.4
- vite (npm): affected from 3.0.0-alpha.0; fixed in 3.0.0-beta.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-35204/ (Markdown: https://insights.sbomify.com/CVE-2022-35204/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-35204
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-35204
- OSV: https://osv.dev/vulnerability/CVE-2022-35204

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-35204/
Summaries are generated and may contain mistakes; the official description above is the record.
