CVE-2025-24959: Zx ZX Allows Environment Variable Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-qwp8-x4ff-5h87
CVSS 5.2
CWE-74
Published
Advisory Summary

CVE-2025-24959 is a MODERATE (CVSS 5.2) zx allows environment variable injection vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Zx libraries in the npm ecosystem. The issue involves zx allows environment variable injection for dotenv api. Remediation is available by upgrading affected packages to version 8.3.2.

CVE-2025-24959 at a Glance

CVE Identifier CVE-2025-24959
GHSA Identifier GHSA-qwp8-x4ff-5h87
Severity MODERATE
CVSS v3.1 Base Score 5.2
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Zx
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H).

Attack Vector Adjacent (AV:A)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2025-24959

To remediate this vulnerability, upgrade all affected Zx dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

zx fixed: 8.3.2
npm install zx@8.3.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls zx

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-24959, inspect your project dependencies using npm:

npm ls zx

Analyze the terminal output to locate any version of Zx in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.3.2), your application is affected.

Note: The npm ls zx command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Zx, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 - [Issue Report](https://github.com/google/zx/issues/) - [Security Policy](https://github.com/google/zx/security/policy) - [Google Vulnerability Disclosure](https://g.co/vulnz) - [Patch](https://github.com/google/zx/pull/1094)

CVE-2025-24959 Affected Zx Versions

1 component(s)
Fixed Versions:
8.3.2
Product / Package Ecosystem Affected Versions Fixed Version
zx
npm
≥ 8.3.1
< 8.3.2
All 1 versions
8.3.1
8.3.2

References

Frequently Asked Questions

What is CVE-2025-24959?
CVE-2025-24959 is a security vulnerability in Zx involving ZX Allows Environment Variable Injection for dotenv API under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Zx versions are affected?
Affected versions include releases prior to 8.3.2 across affected packages: zx.
What version fixes CVE-2025-24959?
Upgrading to 8.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is zx affected?
Yes, zx is affected in releases prior to 8.3.2. Upgrade your dependency to 8.3.2 or later.
What is the CVSS score of CVE-2025-24959?
CVE-2025-24959 has a CVSS v3.1 base score of 5.2 (MODERATE) with vector string CVSS:3.1/AV:A/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2025-24959?
CVE-2025-24959 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2025-24959?
Run the dependency tree command: 'npm ls zx'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qwp8-x4ff-5h87",
  "modified" : "2025-02-04T17:29:11Z",
  "published" : "2025-02-03T22:34:08Z",
  "aliases" : [ "CVE-2025-24959" ],
  "summary" : "ZX Allows Environment Variable Injection for dotenv API",
  "details" : "### Impact\nThis vulnerability is an **Environment Variable Injection** issue in `dotenv.stringify`, affecting `google/zx`  version **8.3.1**.\n\nAn 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.\n\n### Patches\nThis issue has been **patched** in version **8.3.2**. Users should **immediately upgrade** to this version to mitigate the vulnerability.\n\n### Workarounds\nIf 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.\n\n### References\n- [Issue Report](https://github.com/google/zx/issues/)\n- [Security Policy](https://github.com/google/zx/security/policy)\n- [Google Vulnerability Disclosure](https://g.co/vulnz)\n- [Patch](https://github.com/google/zx/pull/1094)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "zx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.3.1"
      }, {
        "fixed" : "8.3.2"
      } ]
    } ],
    "versions" : [ "8.3.1" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/google/zx/security/advisories/GHSA-qwp8-x4ff-5h87"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-24959"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/google/zx/pull/1094"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/google/zx/commit/5ba714d14ecf0555a74d4db96622840ac19839c5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/google/zx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/webpod/envapi/blob/v0.2.1/src/main/ts/envapi.ts#L74-L77"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-02-03T22:34:08Z",
    "nvd_published_at" : "2025-02-03T21:15:15Z"
  }
}