Skip to content
supplychainattack.orgSupply chain attack incident catalog
containedcritical

Malicious code in trimprompt (npm)

The npm package trimprompt@1.0.47 contains malicious obfuscated code with install-time and load-time execution capabilities, including PowerShell spawning via postinstall hooks and host-reconnaissance/beaconing functionality via child_process and HTTP POST calls.

ShareXLinkedInHacker News
Disclosed
Last updated
Blast radius
All npm users who installed trimprompt@1.0.47
Ecosystems
Attack vectors
Affected entities
  • trimprompt · 1.0.47

The npm package trimprompt@1.0.47 was found to contain malicious code across multiple heavily obfuscated JavaScript modules. The obfuscation uses hex-mangled identifiers (_0x...) across numerous files including cache-manager.js, cache.js, ccr.js, dashboard.js, executor.js, file-watcher.js, hooks/claude-hook.js, mcp.js, proxy-conv.js, proxy-resp.js, redactor.js, seed.js, simulate.js, sync.js, tracker.js, and all filters/*.js, deliberately hiding the original structure and destinations.

Two obfuscated files (sync.js and tracker.js) combine require('child_process') with HTTP POST calls carrying host/identifier fields, indicating host-reconnaissance and outbound reporting to a remote endpoint. A postinstall.js script auto-executes on npm install and spawns PowerShell (spawn('powershell',...)) on Windows hosts, and shims.js also invokes child_process with execSync('pwsh...'), providing execution surfaces at install-time and load-time.

The combination of pervasive identifier-level obfuscation across nearly every module, PowerShell-spawning postinstall lifecycle hooks, and obfuscated modules pairing child_process with HTTP POST of host identifiers is inconsistent with a legitimate prompt-trimming utility and matches the pattern of an install-time execution and host-beaconing supply-chain payload. The concrete destination hostnames and URLs remain hidden behind string-array obfuscation.

Indicators of compromise

Packages
  • trimprompt@1.0.47

Remediation

  • Immediately uninstall trimprompt@1.0.47 from all systems
  • Audit npm install logs and package-lock.json files to identify all systems that installed this version
  • Scan affected systems for suspicious PowerShell execution and outbound HTTP POST connections
  • Review system logs for child_process spawning and network activity to remote endpoints
  • Consider the affected systems potentially compromised and perform forensic analysis
  • Update to a safe version of trimprompt if available, or use an alternative package
  • Implement npm package scanning and verification in your CI/CD pipeline

Sources

  1. GitHub Advisory GHSA-cvm3-f6xv-h47p · GitHub Advisory Database

Cite this entry

"Malicious code in trimprompt (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 7, 2026; last updated August 7, 2026. https://supplychainattack.org/incident/malicious-code-in-trimprompt-npm-q6u8if

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 autbank-core (npm)

    The npm package autbank-core contained malicious preinstall and postinstall lifecycle hooks that exfiltrated environment variables, credentials, and system information to a hardcoded webhook.site endpoint during installation.

    npmCompromised package
  2. resolvedcritical

    Malicious code in adxaa (npm)

    The npm package adxaa contained obfuscated malicious JavaScript designed to target users of a specific WordPress site. The payload exfiltrates session data, deletes accounts, and hijacks credentials via email overwrite and password reset.

    npmCompromised package
  3. resolvedcritical

    Malicious code in upload-to-gcp (npm)

    upload-to-gcp@3.2.1 (npm) contains malicious code in its postinstall script that exfiltrates host identifiers to an attacker-controlled endpoint. The package masquerades as a Google Cloud Platform utility but performs unauthorized telemetry collection at install time.

    npmCompromised package
  4. 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