Malicious code in express-session-handler (npm)
The npm package express-session-handler contained malicious code that fetches and executes attacker-controlled JavaScript on module load via a remote jsonbin endpoint. The package masqueraded as Express session middleware but performed arbitrary code execution during installation.
- Disclosed
- Last updated
- Blast radius
- Any Node.js application that installed the malicious express-session-handler package
- Ecosystems
- Attack vectors
- Affected entities
- express-session-handlernpm package
The npm package express-session-handler was found to contain malicious code that executes on module load. The package advertises itself as Express session middleware but includes an initPlugin() routine in index.js that unconditionally performs an HTTPS fetch to https://api.jsonbin.io/v3/b/6a4f5816f5f4af5e29762c92.\n\nThe fetched response is parsed to extract a record.cerookie field, which is then passed to Function.constructor with require bound as an argument, resulting in execution of attacker-controlled JavaScript in the installer's Node.js process. Since the remote jsonbin document is mutable and controlled by the attacker, the code executed on any host requiring this module can be changed at any time.\n\nThe malicious code was disguised with a '/*! normalize-path (ES6 safe version) */' header and included an unused normalizePath helper function to present a false cover story unrelated to the actual behavior.\n\nThe incident was identified and credited to the OpenSSF malicious-packages repository.
Indicators of compromise
- Packages
- express-session-handler
- Domains
- api.jsonbin.io
Remediation
- Immediately uninstall express-session-handler from all affected systems
- Audit all Node.js processes that may have installed this package for signs of compromise
- Review npm audit logs and package-lock.json files to identify when the package was installed
- Replace express-session-handler with a legitimate, verified Express session middleware alternative
- Implement package verification and security scanning in the npm supply chain (e.g., npm audit, Snyk, or similar tools)
- Monitor for any suspicious outbound HTTPS connections to jsonbin.io or similar external endpoints
Sources
- GitHub Advisory GHSA-w25r-wmr3-97hj · GitHub Advisory Database
Cite this entry
"Malicious code in express-session-handler (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 21, 2026; last updated August 21, 2026. https://supplychainattack.org/incident/malicious-code-in-express-session-handler-npm-6s6zgo
Suggest a correction
Found an error or have a newer source? Corrections to factual errors take priority over new entries.
Related incidents
- containedcritical
Malware in svelte-dim-kit
The npm package svelte-dim-kit was found to contain malware, potentially giving attackers full control of affected systems. All systems with this package installed should be considered compromised and secrets/keys rotated immediately from a different computer.
npmCompromised package - containedcritical
Malicious code in @syncraft-labs/react (npm)
The npm package @syncraft-labs/react contained obfuscated malicious code in its ESM distribution that implements the EtherHiding pattern, fetching and executing arbitrary code from an Ethereum smart contract via RPC endpoints. The tampering occurred post-build in the dist/index.js artifact.
npmCompromised package - containedcritical
Malicious code in stillm4ddpocs-demo-sprocket (npm)
The npm package stillm4ddpocs-demo-sprocket version 999.9.12 contains malicious code that exfiltrates system and project metadata via multiple channels (HTTPS, HTTP, and DNS) to a hardcoded callback host. The package uses a high version number to exploit dependency-confusion attacks against organizations with internal packages of the same name.
npmCompromised packageDependency confusion - resolvedcritical
Malicious code in stillm4ddpocs-rtest-bravo (npm)
The npm package stillm4ddpocs-rtest-bravo contained malicious code in its preinstall script that automatically executed during installation, collecting system information and internal package metadata and exfiltrating it to a third-party Interactsh collector via HTTPS and DNS tunneling.
npmCompromised package