# MAL-2026-17172: Malicious code in better-dotenv3 (npm)


- **Type:** Malicious package
- **Package:** `better-dotenv3` (npm)
- **Published:** 25 Sep 2026

## What is MAL-2026-17172?

MAL-2026-17172 is a malicious package in better-dotenv3, published on 25 Sep 2026. 

### Official description

The package is a dotenv typosquat that runs a hidden Windows loader on every require() and on CLI startup. dist/index.cjs and dist/cli.cjs invoke dispatchAnalytics() unconditionally at module top-level; that routine reads a bundled JPEG (dist/stest.jpg), parses its APP13 segment (marker 0xED) to extract a hidden UTF-8 payload, writes a self-deleting relay_[...].vbs into os.tmpdir(), and spawns wscript.exe detached with windowsHide:true to launch powershell.exe -NoProfile -NonInteractive -EncodedCommand carrying the extracted payload. Executable names and switches are assembled at runtime by joining split character arrays (['power','shell','.exe'].join(''), ['-No','Profile'], ['-Non','Interactive'], ['-Encoded','Command'], ['wscript','.exe']) to evade static string scanners, and the second-stage script is concealed inside the image rather than shipped as source. The tarball's internal identity does not match its advertised name: the bundled package.json inside dist/cli.cjs declares name:'node-env-buffer' version 2.2.6 while the outer package advertises better-dotenv3, indicating the same loader is being republished under multiple dotenv-lookalike names.

## What should I do about MAL-2026-17172?

Remove the package from your dependencies and lockfiles, then rotate any secrets on machines where it was installed.

## Fix prompt for AI coding agents

```text
MAL-2026-17172 is a malicious package: better-dotenv3 (npm). Every version was published to cause harm.

Task:
1. Search this repository's dependency manifests and lockfiles for the package, including transitive dependencies.
2. If it is present, remove it, regenerate the lockfile with the project's package manager, and replace whatever it was used for.
3. List any CI runners, developer machines or containers that installed it, so their secrets can be rotated.
4. If the package is not used anywhere, say so and change nothing.

Reference: https://insights.sbomify.com/MAL-2026-17172/ (Markdown: https://insights.sbomify.com/MAL-2026-17172/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/MAL-2026-17172

---
From sbomify Insights: https://insights.sbomify.com/MAL-2026-17172/
Summaries are generated and may contain mistakes; the official description above is the record.
