CVE-2025-24959 Environment Variable Injection for dotenv API in zx

Low 1.0 Published Updated

Attackers can inject environment variables via dotenv.stringify in zx, leading to arbitrary command execution in dependent applications.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2025-24959?

CVE-2025-24959 is a low-severity code injection vulnerability in google zx, published on 3 Feb 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official 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.

Weakness: CWE-94

Which versions are affected by CVE-2025-24959?

2 open source packages ship an affected version, including zx.

PackageAffectedFixed in
zx npmFrom 8.3.18.3.2
zx npmFrom 8.3.18.3.2

How do I fix CVE-2025-24959?

Upgrade zx to 8.3.2 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2025-24959 being exploited?

There is no known exploitation of CVE-2025-24959 in the wild and no public exploit code.

Sources

Also known as GHSA-qwp8-x4ff-5h87, UBUNTU-CVE-2025-24959.

Is CVE-2025-24959 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free