5.6medium
Arbitrary node_modules Directory Deletion in Google zx
- Severity
- 5.6medium CVSS:4.0 by Google
- Exploit likelihood
- 0.09% (higher than 0% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Also known as
- GHSA-w87r-vg9q-crqm
Description
When zx is invoked with --prefer-local=<path>, the CLI creates a symlink named ./node_modules pointing to <path>/node_modules. Due to a logic error in src/cli.ts (linkNodeModules / cleanup), the function returns the target path instead of the alias (symlink path). The later cleanup routine removes what it received, which deletes the target directory itself. Result: zx can delete an external <path>/node_modules outside the current working directory.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Google zx | 8.8.4 | CVE List |
| zx (npm) | before 8.8.5 | GitHub Advisory Database |
All scores
| 5.6medium CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:H/VA:H/SC:N/SI:H/SA:H/E:U | |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:H/VA:H/SC:N/SI:H/SA:H/E:U |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
When zx is invoked with --prefer-local=<path>, the CLI creates a symlink named ./node_modules pointing to <path>/node_modules. Due to a logic error in src/cli.ts (linkNodeModules / cleanup), the function returns the target path instead of the alias (symlink path). The later cleanup routine removes what it received, which deletes the target directory itself. Result: zx can delete an external <path>/node_modules outside the current working directory.
NVD (es)
Cuando zx es invocado con --prefer-local=<path>, la CLI crea un enlace simbólico llamado ./node_modules apuntando a <path>/node_modules. Debido a un error de lógica en src/cli.ts (linkNodeModules / cleanup), la función devuelve la ruta de destino en lugar del alias (ruta del enlace simbólico). La rutina de limpieza posterior elimina lo que recibió, lo que elimina el propio directorio de destino. Resultado: zx puede eliminar un <path>/node_modules externo fuera del directorio de trabajo actual.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-13437 changed 2025-11-20 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-w87r-vg9q-crqm changed 2025-11-21 | CC-BY-4.0 |
| NVD | CVE-2025-13437 changed 2026-10-18 | Public domain |