Malicious Code Injection in dotenv-runtime Package
Summary
MAL-2026-17657: Malicious code in dotenv-runtime (npm). Affects dotenv-runtime 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
dotenv-runtime is an npm package designed to parse .env files for Node.js applications, allowing developers to manage environment variables easily. However, this package has been found to contain malicious code that can compromise the security of applications using it, making it critical for users to be aware of this vulnerability.
Vulnerability Detail
The vulnerability originates from a malicious implementation within the dotenv-runtime package. When the package is required in an application, it executes a function that reads a hidden string from a JPEG file and writes a VBS script to the OS temp directory. This script then invokes PowerShell to download and execute a potentially harmful executable from an external source. The malicious behavior is concealed under the guise of a dotenv parser, making it particularly insidious. The affected version is 1.0.0, and the malicious code can lead to unauthorized access and control over the affected system.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall dotenv-runtime
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-runtime package from your project by executing: npm uninstall dotenv-runtime. Additionally, ensure that your application does not load any untrusted packages that may contain similar vulnerabilities.
Conclusion
The dotenv-runtime package has been identified as containing malicious code that poses a significant security risk. Users are urged to take immediate action to update or remove the package to safeguard their applications. Utilizing tools like Vulert can help monitor for such vulnerabilities in the future.
See every vulnerability recorded for dotenv-runtime →
FAQ
dotenv-runtime is an npm package used to parse .env files for managing environment variables in Node.js applications.
The malicious code reads a hidden string from a JPEG file, writes a VBS script to the temp directory, and executes it to download and run harmful software.
You should update the package to the latest version or remove it entirely to avoid potential security risks.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software using just the package-lock.json file.
Yes, you can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.