1.0low
Environment Variable Injection for dotenv API in zx
- Severity
- 1.0low CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.26% (higher than 11% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-qwp8-x4ff-5h87
Description
zx is a tool for writing better scripts. An attacker with control over environment variable values can inject unintended environment variables into `process.env`. This can lead to arbitrary command execution or unexpected behavior in applications that rely on environment variables for security-sensitive operations. Applications that process untrusted input and pass it through `dotenv.stringify` are particularly vulnerable. This issue has been patched in version 8.3.2. Users should immediately upgrade to this version to mitigate the vulnerability. If upgrading is not feasible, users can mitigate the vulnerability by sanitizing user-controlled environment variable values before passing them to `dotenv.stringify`. Specifically, avoid using `"`, `'`, and backticks in values, or enforce strict validation of environment variables before usage.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| google zx | >= 8.3.0, < 8.3.2 | CVE List |
| zx (npm) | from 8.3.1 before 8.3.2 | GitHub Advisory Database |
All scores
| GitHub_M | 1.0low CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:A/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N |
| GitHub | 5.2medium CVSS:3.1 | CVSS:3.1/AV:A/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H |
Classification
What each source says
CVE List
zx is a tool for writing better scripts. An attacker with control over environment variable values can inject unintended environment variables into `process.env`. This can lead to arbitrary command execution or unexpected behavior in applications that rely on environment variables for security-sensitive operations. Applications that process untrusted input and pass it through `dotenv.stringify` are particularly vulnerable. This issue has been patched in version 8.3.2. Users should immediately upgrade to this version to mitigate the vulnerability. If upgrading is not feasible, users can mitigate the vulnerability by sanitizing user-controlled environment variable values before passing them to `dotenv.stringify`. Specifically, avoid using `"`, `'`, and backticks in values, or enforce strict validation of environment variables before usage.
GitHub Advisory Database
Impact
This vulnerability is an Environment Variable Injection issue in dotenv.stringify, affecting google/zx version 8.3.1.
An attacker with control over environment variable values can inject unintended environment variables into process.env. This can lead to arbitrary command execution or unexpected behavior in applications that rely on environment variables for security-sensitive operations. Applications that process untrusted input and pass it through dotenv.stringify are particularly vulnerable.
Patches
This issue has been patched in version 8.3.2. Users should immediately upgrade to this version to mitigate the vulnerability.
Workarounds
If upgrading is not feasible, users can mitigate the vulnerability by sanitizing user-controlled environment variable values before passing them to dotenv.stringify. Specifically, avoid using ", ', and backticks in values, or enforce strict validation of environment variables before usage.
References
NVD (es)
zx es una herramienta para escribir mejor scripts. Un atacante con control sobre los valores de las variables de entorno puede inyectar variables de entorno no deseadas en `process.env`. Esto puede provocar la ejecución arbitraria de comandos o un comportamiento inesperado en aplicaciones que dependen de las variables de entorno para operaciones sensibles a la seguridad. Las aplicaciones que procesan entradas no confiables y las pasan a través de `dotenv.stringify` son particularmente vulnerables. Este problema se ha corregido en la versión 8.3.2. Los usuarios deben actualizar inmediatamente a esta versión para mitigar la vulnerabilidad. Si la actualización no es posible, los usuarios pueden mitigar la vulnerabilidad mediante Desinfectando valores de variables de entorno controlados por el usuario antes de pasarlos a `dotenv.stringify`. Específicamente, evite usar `"`, `'` y comillas simples invertidas en los valores, o aplique una validación estricta de las variables de entorno antes del uso.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-24959 changed 2025-02-12 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-qwp8-x4ff-5h87 changed 2025-02-04 | CC-BY-4.0 |
| NVD | CVE-2025-24959 changed 2026-06-17 | Public domain |