
A hands-on, containerized lab environment to simulate and exploit the Path Traversal vulnerability in Vite's development server, identified as CVE-2025-31486.
This lab demonstrates a significant Path Traversal vulnerability found in older versions of Vite, a modern web development build tool. The vulnerability allows an attacker to bypass security constraints in the Vite development server and read arbitrary files from the local file system.
The core of the issue lies in how Vite's asset plugin processes URLs. By crafting a special URL with suffixes like ?.svg and ?.wasm?init, an attacker can trick the server into skipping critical security checks (specifically the server.fs.deny function), granting access to sensitive files like /etc/passwd.
--host flag.build.assetsInlineLimit (default is 4KB), as Vite inlines these files as Base64 strings in its response.This repository contains everything you need to safely run a vulnerable Vite server and perform the exploit yourself. You can run the simulation in two ways:
Get a full, cloud-based development environment in seconds. No local setup required.
Launch Codespace: Click the "Open in GitHub Codespaces" button at the top of this README.
Wait for Setup: GitHub will prepare your cloud environment. This might take a minute. A terminal will appear at the bottom of the editor once it's ready.
Start the Vulnerable Server: In the terminal, run the following single command:
docker compose up
You will see output indicating that the vulnerable Vite development server is running and accessible.
Perform the Exploit:
+ icon in the terminal panel).If you prefer to run the lab on your own machine, follow these steps.
Prerequisites:
Instructions:
Clone the Repository:
git clone https://github.com/hackmelocal/CVE-2025-31486-Simulation.git
cd CVE-2025-31486-Simulation
Start the Vulnerable Server: In your terminal, run the single command:
docker compose up
This command will build the Docker image (if not already built) and start the vulnerable Vite server.
Perform the Exploit: