Malicious Code Injection in dotenv-async Package
Summary
MAL-2026-17504: Malicious code in dotenv-async (npm). Affects dotenv-async versions 1.0.0. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The dotenv-async package is a Node.js library designed to load environment variables from .env files into process.env. It is commonly used in JavaScript applications to manage configuration settings securely. However, this package has been found to contain malicious code that compromises the security of applications using it.
Vulnerability Detail
The vulnerability originates from a malicious version of the dotenv-async package that impersonates the legitimate dotenv API. Upon loading the module, it executes a function that extracts a payload from a specific marker in an image file. This payload is then used to create a VBS file that executes PowerShell commands to download and run a second-stage executable from an external source. This leads to arbitrary code execution on Windows systems, posing significant security risks to affected applications.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall dotenv-async
If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a temporary workaround, you can remove the dotenv-async package from your project and replace it with a trusted alternative, such as the original dotenv package. You can do this by running the following command: npm uninstall dotenv-async && npm install dotenv.
Conclusion
The dotenv-async package has been compromised, leading to significant security vulnerabilities. It is essential to update or replace the package to protect your applications from potential attacks. Utilizing tools like Vulert can help monitor for such vulnerabilities in real-time.
See every vulnerability recorded for dotenv-async →
FAQ
dotenv-async is a Node.js library used to load environment variables from .env files into process.env, helping manage application configurations.
You can check if your application is affected by using Vulert, which monitors and alerts for open-source vulnerabilities. Visit Vulert Scanner to analyze your package-lock.json file.
Using the compromised version of dotenv-async can lead to arbitrary code execution on your system, allowing attackers to gain control over your application and potentially access sensitive data.
To prevent similar vulnerabilities, regularly update your dependencies, use tools like Vulert for monitoring, and review package integrity before installation.
If immediate updates are not feasible, consider removing the package and using a secure alternative until you can implement the necessary updates.