Skip to content
Heist/ feed
Unrated

Malicious code in secure-env3 (npm)

Type: advisorySource: OSV1 source record

--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (5cb86188f9853b34c6dc3cf9c8259a789920326e8ddf4ae4cd3566385bba3ea1) The package presents itself as a dotenv-style environment loader but ships a Windows dropper that fires automatically on module load and on CLI invocation. Both dist/index.cjs (the package main) and dist/cli.cjs (the bin) contain an inlined routine dispatchAnalytics() invoked at top level. That routine reads dist/stest.jpg, extracts an encoded payload from the JPEG APP14 (0xED) segment, writes a self-deleting VBS wrapper to os.tmpdir(), and launches it via wscript.exe to run powershell.exe with -EncodedCommand, using detached and windowsHide to hide the console. The strings 'powershell.exe', 'wscript.exe', '-NoProfile', '-NonInteractive', and '-EncodedCommand' are reconstructed by joining split fragments to evade static analysis, and the executable content is smuggled inside a JPEG rather than appearing as a literal in source. Because the payload is opaque encoded PowerShell decoded at runtime from a bundled image, the eventual behavior on the installer's Windows host is fully attacker-controlled. Any require('secure-env3'), import 'secure-env3/config', or execution of the dot2env CLI on Windows triggers this hidden execution path.

Announced Group revision 1
Original source ↗

MAL-2026-17178

Primary source · Revision 1

Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.

Security context

Source reference: osv:MAL-2026-17178

secure-env3

Source reference: /affected/0/package/name

Affected versions
1.0.1

Source reference: /affected/0/versions

Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Structured affected-version data

Original package identities and version rules from this source.

[
  {
    "package": {
      "name": "secure-env3",
      "purl": "pkg:npm/secure-env3",
      "ecosystem": "npm"
    },
    "versions": [
      "1.0.1"
    ],
    "database_specific": {
      "cwes": [
        {
          "name": "Embedded Malicious Code",
          "cweId": "CWE-506",
          "description": "The product contains code that appears to be malicious in nature."
        }
      ],
      "source": "https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/secure-env3/MAL-2026-17178.json",
      "indicators": {
        "evidence_files": [
          {
            "path": "dist/decode.js",
            "tlsh": "03516242adb2a10a076397b787c740282375fd03b404d894b85cc7415faa79e467befd",
            "sha256": "f1af48cff9984a5d522d86b82f81dae9deb7d9cf42f12c68253a43acea100d22"
          },
          {
            "path": "dist/index.cjs",
            "tlsh": "4262f784b3dcb03617eb62e190ab4407e9f5da95408c1418f294e4bb35e46db42fbf79",
            "sha256": "97fa0d7666e80c68a3cd4f3326dc31bd9203619d6bbae7449efe62de15c4e815"
          }
        ],
        "package_integrity": [
          {
            "hashes": {
              "sha1": "737ac695b57fc0efe79e9ea9c6c8224127b3dcac",
              "sha512_sri": "sha512-mVL8mEF+RFER9VqnpdTNSEBZCUuMmnLcbdbbSgRomDYg38ScDhbFLqIBJpRoVVbe2XlXNOs1eClcyeGFGAUu8A=="
            },
            "filename": "secure-env3-1.0.1.tgz"
          }
        ]
      }
    }
  }
]

Publisher severity

No explicit severity was provided.

Event
#14783 · Revision 1
Added to Heist Feed
Publisher date
Read the original announcement