Skip to content
supplychainattack.orgSupply chain attack incident catalog
containedcritical

Malicious code in safe-local-env-loader (npm)

safe-local-env-loader is a malicious npm package that impersonates the legitimate dotenv library. Upon installation and require(), it captures desktop screenshots every 3 seconds, exfiltrates them to a hardcoded C2 server, and provides remote operators with interactive control over the host via mouse and keyboard injection. On Windows, it establishes persistence via registry Run key.

ShareXLinkedInHacker News
Disclosed
Last updated
Blast radius
Any application that installed safe-local-env-loader; all users running affected applications on Windows and macOS systems
Ecosystems
Attack vectors
Affected entities
  • safe-local-env-loaderMalicious npm package impersonating dotenv

safe-local-env-loader is a typosquatting/impersonation attack targeting developers who intended to use the legitimate dotenv package. The malicious package copies the description, repository, homepage, and most of lib/main.js from the authentic motdotla/dotenv project, with a single malicious addition: a require() call to ./tui-options that activates a hidden agent on module load.

The tui-options.js module performs screen capture exfiltration and remote control injection. On Windows and macOS, it captures full desktop screenshots every 3 seconds and POSTs them along with hostname, platform, and resolution metadata to http://192.99.204.157:5000/upload. The same module polls http://192.99.204.157:5000/get_buffer every second for command payloads, then replays mouse coordinates and keyboard key events against the user's desktop using the @nut-tree-fork/nut-js library, granting the remote operator full interactive control.

On Windows systems, the module establishes persistence by writing a VBS launcher script to %APPDATA%\ScreenCaptureClient\launch-screen-client.vbs and registering it in HKCU\Software\Microsoft\Windows\CurrentVersion\Run under the name ScreenCaptureClient, ensuring the agent auto-starts on every user logon.

Any application that requires safe-local-env-loader is immediately compromised, exposing all screen content and allowing remote input injection and persistent execution across reboots. The attack was identified and credited to the OpenSSF malicious-packages project.

Indicators of compromise

Packages
  • safe-local-env-loader
IPs
  • 192.99.204.157

Remediation

  • Immediately uninstall safe-local-env-loader from all systems and projects
  • Audit npm package.json and lock files for any presence of safe-local-env-loader
  • Regenerate all credentials and secrets that may have been visible on screen during the compromise
  • On Windows systems, remove the ScreenCaptureClient registry entry from HKCU\Software\Microsoft\Windows\CurrentVersion\Run and delete %APPDATA%\ScreenCaptureClient\launch-screen-client.vbs
  • Perform a full system scan for persistence mechanisms and C2 communication
  • Review network logs for connections to 192.99.204.157:5000
  • Reinstall affected applications using only the legitimate dotenv package from npm
  • Implement package name verification and allowlisting in dependency management to prevent typosquatting attacks

Sources

  1. GitHub Advisory GHSA-4g37-2gh5-825v · GitHub Advisory Database

Cite this entry

"Malicious code in safe-local-env-loader (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 11, 2026; last updated August 11, 2026. https://supplychainattack.org/incident/malicious-code-in-safe-local-env-loader-npm-121puc

Suggest a correction

Found an error or have a newer source? Corrections to factual errors take priority over new entries.

  1. resolvedcritical

    Malicious code in @finaxis/common-js (npm)

    The npm package @finaxis/common-js was published with a README and keywords copied from lodash v4.18.1, but contained a heavily obfuscated Xelis (XEL) proof-of-work cryptominer instead of lodash functionality. Consumers installing this package would unknowingly run a covert CPU/GPU miner on their systems.

    npmCompromised packageTyposquatting
  2. resolvedcritical

    Malicious code in akamai-sensor (npm)

    A malicious npm package named akamai-sensor impersonated Akamai's legitimate sensor_data anti-bot SDK. The package contained hidden JavaScript code concealed using invisible Unicode characters and implemented a dynamic command-and-control channel via a Google Calendar dead-drop, enabling arbitrary code execution on installation.

    npmCompromised packageTyposquatting
  3. resolvedcritical

    Malicious code in depcruise-wrap-stream-in-html (npm)

    depcruise-wrap-stream-in-html@99.9.1 is a malicious npm package that mimics an internal helper of dependency-cruiser. It is a hollow package that downloads and executes arbitrary code from a Google Cloud Storage bucket during installation.

    npmCompromised packageDependency confusionTyposquatting
  4. resolvedcritical

    Malicious code in wct-st (npm)

    The npm package wct-st contained malicious code in its postinstall lifecycle script that collected and exfiltrated host identifiers to a remote endpoint. The package name resembles the deprecated web-component-tester, consistent with a typosquatting attack.

    npmCompromised packageTyposquatting