Malicious code in chai-as-gateway (npm)
The npm package chai-as-gateway contained malicious code that executes automatically on installation. The package masquerades as a logger (copying documentation from pino) but includes an obfuscated blob that harvests AWS credentials and other sensitive files from the home directory and exfiltrates them via HTTP.
- Disclosed
- Last updated
- Blast radius
- Any developer or system that installed the malicious chai-as-gateway package; AWS credentials and other sensitive files in the home directory of affected systems.
- Ecosystems
- Attack vectors
- Affected entities
- chai-as-gatewaynpm package containing malicious code
The npm package chai-as-gateway was published with malicious code designed to execute automatically when the package is imported. The package falsely advertises itself as a logger, with README and type definitions copied directly from the legitimate pinojs/pino project, but its actual exported middleware is a no-op function.
The malicious payload is contained in lib/config.js, a ~4MB obfuscated blob using obfuscator.io-style techniques including string-array rotation and hex-escaped identifiers. This obfuscated code is unconditionally executed at module import time and contains references to child_process (exec/spawn), axios for HTTP communication, filesystem traversal operations, AWS credential paths, and base64 encoding—the characteristic pattern of a credential harvester.
The package name resembles popular unrelated packages, and the author metadata uses a generic email address (hello@jsonspack.com). The package description ('vulnerabilities management document') does not match the cloned pino documentation, indicating deceptive packaging practices.
Any system that installed this package would automatically execute the attacker-controlled code, allowing harvesting of AWS credentials and other sensitive files from the installer's home directory and exfiltration over HTTP.
Indicators of compromise
- Packages
- chai-as-gateway
Remediation
- Immediately uninstall chai-as-gateway from all systems and projects
- Audit npm install logs to identify when and where the package was installed
- Rotate all AWS credentials and secrets that may have been exposed on affected systems
- Review home directory access logs and file system activity during the installation period
- Scan systems for any persistence mechanisms or additional malicious artifacts
- Update dependency lock files (package-lock.json, yarn.lock) to remove references to chai-as-gateway
- Implement package verification and scanning in CI/CD pipelines to detect obfuscated or suspicious code patterns
Sources
- GitHub Advisory GHSA-qwfr-cq2f-mc9p · GitHub Advisory Database
Cite this entry
"Malicious code in chai-as-gateway (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 19, 2026; last updated August 19, 2026. https://supplychainattack.org/incident/malicious-code-in-chai-as-gateway-npm-1euyw2
Suggest a correction
Found an error or have a newer source? Corrections to factual errors take priority over new entries.
Related incidents
- resolvedcritical
Malicious code in create-coin (npm)
create-coin@20.1.1 on npm contained malicious postinstall code that collected sensitive environment variables, credentials, and host reconnaissance data. The package impersonated an esbuild platform build and exfiltrated data to a hardcoded endpoint.
npmCompromised packageTyposquatting - containedcritical
Malicious code in chai-as-testkit (npm)
The npm package chai-as-testkit is a typosquat/impersonation attack delivering obfuscated malicious code that executes on import. The package falsely claims to be a vulnerability management tool but ships pino library files under a different author, with a synthetic stub that loads a 4MB+ obfuscated bundle containing attacker-controlled code.
npmTyposquattingCompromised package - resolvedcritical
Malicious code in @next-fonts/font (npm)
@next-fonts/font is a typosquat package on npm that executes arbitrary attacker-controlled code via a blockchain-mediated C2 channel when its Inter() function is called. The malicious payload is base64-encoded and executed through Node.js spawn or eval, with no legitimate font functionality.
npmTyposquattingCompromised package - resolvedcritical
Malicious code in chai-as-soul (npm)
chai-as-soul@2.3.5 is a typosquat of the pino logging library containing malicious code that exfiltrates environment variables (including AWS/GCP/CI tokens) and executes arbitrary remote code on installation.
npmTyposquattingCompromised package