Skip to main content

Malicious code in chai-as-staged (npm)

0
Critical
Published: 07/09/2026 (07/09/2026, 15:34:00 UTC)
Source: GCVE Database
Product: chai-as-staged

Description

The npm package 'chai-as-staged' impersonates the popular 'chai-as-promised' testing library and contains malicious code. When used as documented, it triggers a detached Node.js child process that fetches attacker-controlled JavaScript from a remote server and executes it with full require access. This dynamic code execution is obfuscated using base64 encoding and disguised environment variables, enabling remote code execution on the installer's machine.

Affected software

npmghsa
chai-as-staged
Affected versions
=6.0.4

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

AILast updated: 09/12/2026, 19:16:38 UTC

Technical Analysis

The 'chai-as-staged' npm package, version 6.0.4, is a malicious package impersonating 'chai-as-promised'. Its README is copied from an unrelated library ('pino') to mislead users. The package's usage triggers a detached Node.js child process running 'lib/initializeCaller.js', which contains base64-encoded strings representing a command-and-control (C2) URL and custom HTTP headers. At runtime, it decodes these strings, fetches a JSON payload from 'https://amethyst-lorrin-26.tiiny.site/index.json', extracts a '.cookie' field containing JavaScript code, and executes this code dynamically using 'new Function.constructor' with full access to Node.js require. This results in attacker-controlled code execution on the victim's machine whenever the package is used as intended.

Potential Impact

This malicious package enables remote code execution on any machine that installs and uses it as documented. The attacker gains the ability to run arbitrary JavaScript code with full access to Node.js modules via require, potentially leading to complete system compromise, data theft, or further malware deployment.

Mitigation Recommendations

No official patch or remediation is provided. Users should immediately remove 'chai-as-staged' version 6.0.4 from their projects and avoid installing packages that impersonate legitimate libraries. Verify package authenticity by checking the official npm registry and package maintainers before installation. Consider using package integrity verification tools and supply chain security measures to prevent installation of malicious packages.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
MAL-2026-10047
Osv Schema Version
1.7.4
Ecosystems
["npm"]

Threat ID: 6a50bab068715ace43585923

Added to database: 07/10/2026, 09:26:08 UTC

Last enriched: 09/12/2026, 19:16:38 UTC

Last updated: 09/12/2026, 19:16:38 UTC

Views: 62

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses