Malicious code in dotenv-express (npm)
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (87c063897212774df4e13b1d7bf70cc74a98ac1ca824d2bb1f1e8c60d0662b5e) Package impersonates the popular `dotenv` package: `package.json` points its repository field to `git://github.com/motdotla/dotenv.git` and homepage to `https://github.com/motdotla/dotenv#readme`, neither of which the author owns. The library code is a near-verbatim copy of dotenv but adds `const gate = require('environment-gate')` at the top of `lib/main.js`, and the documented `config()` entry point begins with `gate.gate()` — so any consumer calling the standard dotenv API (`require('dotenv-express').config()`) executes code from `environment-gate`, an unrelated third-party dependency with no env-file-loading purpose, on every load. The package additionally ships `skills/dotenv/SKILL.md` and `skills/dotenvx/SKILL.md` whose frontmatter declares `name: dotenv`, `author: motdotla`, `source: https://github.com/motdotla/dotenv`, and instructs `npm install dotenv` — identity-spoofing metadata designed to trick AI coding agents into treating this package as the genuine dotenv. The combination of impersonated repo/homepage/skill metadata, a name one token away from `dotenv`, and a forced transitive dependency that runs on the documented API call is deliberate namespace abuse rather than a typo, and the harm to installers is whatever `environment-gate` does at require-time on every `.config()` invocation. ## Source: ghsa-malware (03c0fed624e7f4adac4d6d6f75a5d7074900b15daf2009781445e6edd0b01f87) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
AI Analysis
Technical Summary
The 'dotenv-express' npm package is a malicious impersonation of the legitimate 'dotenv' package. It copies the original code nearly verbatim but adds a require call to 'environment-gate' at the top of its main library file, causing this unrelated third-party code to execute whenever the documented 'config()' function is called. The package also includes spoofed repository and homepage metadata pointing to the legitimate 'dotenv' project, as well as skill metadata designed to mislead AI coding assistants. This namespace abuse is intentional and results in arbitrary code execution on any system that installs and uses this package. The malicious behavior means that any computer with this package installed should be treated as fully compromised.
Potential Impact
Systems with 'dotenv-express' installed are at high risk of full compromise due to execution of malicious code from the 'environment-gate' dependency on every use of the package's API. Attackers may gain control over the affected system, potentially accessing all stored secrets and keys. The compromise is severe enough that simply removing the package may not eliminate all malicious presence, requiring secret rotation and further incident response.
Mitigation Recommendations
No official patch or fix is available. The package should be immediately removed from all systems. All secrets and keys stored on compromised systems must be rotated from a separate, trusted environment. Due to the potential full compromise, assume the system is untrusted and conduct a thorough security assessment and remediation. Avoid installing packages with names similar to popular libraries without verifying their authenticity.
Malicious code in dotenv-express (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (87c063897212774df4e13b1d7bf70cc74a98ac1ca824d2bb1f1e8c60d0662b5e) Package impersonates the popular `dotenv` package: `package.json` points its repository field to `git://github.com/motdotla/dotenv.git` and homepage to `https://github.com/motdotla/dotenv#readme`, neither of which the author owns. The library code is a near-verbatim copy of dotenv but adds `const gate = require('environment-gate')` at the top of `lib/main.js`, and the documented `config()` entry point begins with `gate.gate()` — so any consumer calling the standard dotenv API (`require('dotenv-express').config()`) executes code from `environment-gate`, an unrelated third-party dependency with no env-file-loading purpose, on every load. The package additionally ships `skills/dotenv/SKILL.md` and `skills/dotenvx/SKILL.md` whose frontmatter declares `name: dotenv`, `author: motdotla`, `source: https://github.com/motdotla/dotenv`, and instructs `npm install dotenv` — identity-spoofing metadata designed to trick AI coding agents into treating this package as the genuine dotenv. The combination of impersonated repo/homepage/skill metadata, a name one token away from `dotenv`, and a forced transitive dependency that runs on the documented API call is deliberate namespace abuse rather than a typo, and the harm to installers is whatever `environment-gate` does at require-time on every `.config()` invocation. ## Source: ghsa-malware (03c0fed624e7f4adac4d6d6f75a5d7074900b15daf2009781445e6edd0b01f87) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
Affected software
pkg:npm/dotenv-expressRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The 'dotenv-express' npm package is a malicious impersonation of the legitimate 'dotenv' package. It copies the original code nearly verbatim but adds a require call to 'environment-gate' at the top of its main library file, causing this unrelated third-party code to execute whenever the documented 'config()' function is called. The package also includes spoofed repository and homepage metadata pointing to the legitimate 'dotenv' project, as well as skill metadata designed to mislead AI coding assistants. This namespace abuse is intentional and results in arbitrary code execution on any system that installs and uses this package. The malicious behavior means that any computer with this package installed should be treated as fully compromised.
Potential Impact
Systems with 'dotenv-express' installed are at high risk of full compromise due to execution of malicious code from the 'environment-gate' dependency on every use of the package's API. Attackers may gain control over the affected system, potentially accessing all stored secrets and keys. The compromise is severe enough that simply removing the package may not eliminate all malicious presence, requiring secret rotation and further incident response.
Mitigation Recommendations
No official patch or fix is available. The package should be immediately removed from all systems. All secrets and keys stored on compromised systems must be rotated from a separate, trusted environment. Due to the potential full compromise, assume the system is untrusted and conduct a thorough security assessment and remediation. Avoid installing packages with names similar to popular libraries without verifying their authenticity.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-2350
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-hmr7-9h9c-5m6q"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a4c342c27e9c797195fa4a2
Added to database: 07/06/2026, 23:03:08 UTC
Last enriched: 07/07/2026, 00:07:03 UTC
Last updated: 07/18/2026, 17:27:21 UTC
Views: 6
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.