Malicious code in chai-as-assured (npm)
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (bd28efd7a3d07f87ec22556cc25a8c07117fa4cdd237c6cb1db750c976a11836) chai-as-assured impersonates the popular chai-as-promised package (matching README, author, and API surface). When the exported plugin function is invoked under normal usage, an async IIFE in the plugin body base64-decodes a hardcoded URL (https://amethyst-lorrin-26.tiiny.site/index.json), performs an axios.get against that anonymous third-party host with a disguised header, and executes the response's `cookie` field as JavaScript via `new Function.constructor('require', response)(require)`. The fetched payload runs with full Node module privileges (filesystem, network, child_process, etc.) because `require` is passed in. The C2 URL, header name (`x-secret-key`), and header value are concealed as base64 strings inside a fake local `process.env` object (DEV_API_KEY / DEV_SECRET_KEY / DEV_SECRET_VALUE) that shadows Node's global to evade casual source review. The combination of name-confusion against a top-100 chai ecosystem package, deliberate obfuscation of attacker infrastructure, an unpinned anonymous tiiny.site host, and dynamic execution of the fetched response with `require` is an unambiguous remote-code-execution dropper targeting any project that installs and loads this plugin. ## Source: ghsa-malware (c485746666d65194fcec1929637bee2ef3f7f7c1a427a5e28eaf2ce162ea8c19) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
AI Analysis
Technical Summary
chai-as-assured is a malicious npm package that mimics the legitimate chai-as-promised package by copying its README, author, and API surface. Upon invocation, it asynchronously fetches a payload from a disguised third-party URL (hosted on tiiny.site) using axios with obfuscated headers. The fetched payload is executed dynamically using new Function.constructor with the Node.js require function passed in, granting the payload full access to the filesystem, network, and process control. The attacker infrastructure details are concealed via base64 encoding and a fake local process.env object to evade detection. This results in a remote code execution dropper that compromises any project loading this plugin. The only affected version explicitly stated is 7.1.2. The package should be considered fully compromising any host where it is installed or executed.
Potential Impact
Systems that install or run chai-as-assured version 7.1.2 are fully compromised due to remote code execution capabilities granted to the attacker. This allows arbitrary code execution with full Node.js privileges, including filesystem and network access. All secrets, keys, and sensitive data on the compromised system may be exposed or stolen. The malicious code dynamically fetches and executes attacker-controlled payloads, enabling persistent and flexible control over the affected environment.
Mitigation Recommendations
No official patch or fix is available. The affected package version 7.1.2 should be immediately removed from all systems. All secrets and keys stored on compromised systems must be rotated from a separate, trusted environment. Due to the full system compromise risk, assume that removing the package alone may not fully remediate the system; a full incident response and system rebuild may be necessary.
Malicious code in chai-as-assured (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (bd28efd7a3d07f87ec22556cc25a8c07117fa4cdd237c6cb1db750c976a11836) chai-as-assured impersonates the popular chai-as-promised package (matching README, author, and API surface). When the exported plugin function is invoked under normal usage, an async IIFE in the plugin body base64-decodes a hardcoded URL (https://amethyst-lorrin-26.tiiny.site/index.json), performs an axios.get against that anonymous third-party host with a disguised header, and executes the response's `cookie` field as JavaScript via `new Function.constructor('require', response)(require)`. The fetched payload runs with full Node module privileges (filesystem, network, child_process, etc.) because `require` is passed in. The C2 URL, header name (`x-secret-key`), and header value are concealed as base64 strings inside a fake local `process.env` object (DEV_API_KEY / DEV_SECRET_KEY / DEV_SECRET_VALUE) that shadows Node's global to evade casual source review. The combination of name-confusion against a top-100 chai ecosystem package, deliberate obfuscation of attacker infrastructure, an unpinned anonymous tiiny.site host, and dynamic execution of the fetched response with `require` is an unambiguous remote-code-execution dropper targeting any project that installs and loads this plugin. ## Source: ghsa-malware (c485746666d65194fcec1929637bee2ef3f7f7c1a427a5e28eaf2ce162ea8c19) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
chai-as-assured is a malicious npm package that mimics the legitimate chai-as-promised package by copying its README, author, and API surface. Upon invocation, it asynchronously fetches a payload from a disguised third-party URL (hosted on tiiny.site) using axios with obfuscated headers. The fetched payload is executed dynamically using new Function.constructor with the Node.js require function passed in, granting the payload full access to the filesystem, network, and process control. The attacker infrastructure details are concealed via base64 encoding and a fake local process.env object to evade detection. This results in a remote code execution dropper that compromises any project loading this plugin. The only affected version explicitly stated is 7.1.2. The package should be considered fully compromising any host where it is installed or executed.
Potential Impact
Systems that install or run chai-as-assured version 7.1.2 are fully compromised due to remote code execution capabilities granted to the attacker. This allows arbitrary code execution with full Node.js privileges, including filesystem and network access. All secrets, keys, and sensitive data on the compromised system may be exposed or stolen. The malicious code dynamically fetches and executes attacker-controlled payloads, enabling persistent and flexible control over the affected environment.
Mitigation Recommendations
No official patch or fix is available. The affected package version 7.1.2 should be immediately removed from all systems. All secrets and keys stored on compromised systems must be rotated from a separate, trusted environment. Due to the full system compromise risk, assume that removing the package alone may not fully remediate the system; a full incident response and system rebuild may be necessary.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-6532
- Osv Schema Version
- 1.7.4
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a3ef79327e9c79719ff7b71
Added to database: 06/26/2026, 22:05:07 UTC
Last enriched: 07/11/2026, 12:36:57 UTC
Last updated: 07/28/2026, 05:18:52 UTC
Views: 39
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.