Summary
Vite+ versions prior to 0.1.17 contain a path traversal vulnerability in downloadPackageManager() where an untrusted version string is used directly to construct filesystem paths.
An attacker who can influence this value may escape the intended cache directory and cause deletion, replacement, or population of arbitrary directories on the host system.
Affected context
This issue affects environments using Vite+ where:
- The
downloadPackageManager()function is invoked as part of toolchain setup or package manager management, and - The
versionparameter can be controlled or influenced by external input (e.g., project configuration, user input, remote metadata, or plugins).
Instead of being confined to VP_HOME/package_manager/<pm>/, attacker-controlled path segments can redirect file operations to other directories, depending on process permissions and file system layout.
Exploit preconditions
- Attack surface: Interfaces (CLI, API, configuration, or plugin hooks) that pass a version string into
downloadPackageManager(). - Required access: Ability to control or tamper with the
versionvalue used by Vite+ (directly as a user, through a CI script, or via a compromised configuration). - Trigger point: Execution of
downloadPackageManager()when Vite+ attempts to download or manage a package manager binary or cache entry. - Why exploitation is possible: The code concatenates the unvalidated
versionstring into filesystem paths, allowing../sequences or absolute paths to escapeVP_HOME/package_manager/<pm>/and target arbitrary directories.
Why this happens
The vulnerability stems from trusting path components provided via an untrusted version string and incorporating them directly into filesystem operations.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where lack of canonicalization and validation allows directory traversal via ../ or absolute paths.
Conceptually, the function assumes that version is a simple identifier, but in practice it can contain path traversal tokens that subvert the intended cache root and redirect delete/replace/populate operations to attacker-chosen locations.
Potential impact
- Deletion of arbitrary directories that the Vite+ process can access (e.g., source code directories, build artifacts, configuration files).
- Overwriting or replacing files and directories outside the cache root with attacker-controlled content.
- Corruption of application or build tool configuration, potentially leading to code execution through poisoned scripts, hooks, or binaries executed later in the pipeline.
- Disruption of CI/CD pipelines or developer environments by damaging critical project or system directories.
- Facilitation of further attacks by planting malicious content where it will later be executed or served.
General mitigation guidance
Mitigation strategies typically focus on enforcing strict directory constraints and treating all path components as untrusted:
- Normalize and canonicalize constructed paths and verify that they remain within the intended root (
VP_HOME/package_manager/<pm>/), rejecting any input that resolves outside this directory. - Reject or sanitize
versionvalues that contain path separators,..segments, leading slashes, or drive specifiers, and enforce an allowlist pattern (e.g., semantic-version-like strings). - Use filesystem APIs that support explicit base directories and prevent traversal outside them, rather than string concatenation.
- Run Vite+ and related tooling with the least privileges necessary, using an isolated user account and restricting write access to only those directories that must be modified.
- Treat all configuration and metadata that influence
versionas untrusted, and introduce validation layers before passing them into filesystem code.
How teams detect issues like this
Effective detection combines code-level analysis with runtime monitoring:
- Static analysis: Flag any use of user-influenced strings (like
version) being concatenated into paths used by delete, rename, move, or write operations without normalization and boundary checks. - Code review: Look for filesystem calls where:
- The path is built by string concatenation.
- No explicit check enforces confinement to a known root directory.
- Inputs are assumed to be "safe" identifiers (e.g., version numbers) but are not validated.
- Policy enforcement: Introduce secure coding guidelines that require canonicalization and directory-bound checks for any path derived from external input, and integrate automated checks into CI.
- Runtime monitoring: Optionally log and alert on unexpected path patterns originating from Vite+, such as access attempts outside the configured
VP_HOMEtree, to detect suspicious behavior or exploitation attempts.

