Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

Malicious code in chai-as-persisted (npm)

0
Critical
Published: 06/27/2026 (06/27/2026, 02:32:25 UTC)
Source: GCVE Database
Product: chai-as-persisted

Description

The npm package 'chai-as-persisted' is a malicious typosquatting package impersonating the legitimate 'chai-as-promised' package. Its postinstall script executes attacker-controlled JavaScript by decoding a hidden command-and-control URL and running code fetched from it, resulting in remote code execution (RCE) on the installer's machine. The malicious code runs detached from the install process, maintaining persistence beyond installation. Installing this package fully compromises the affected system, risking exposure of all stored secrets and keys.

Affected software

npmghsa
chai-as-persisted
Affected versions
=4.2.8=6.1.9

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: 06/30/2026, 23:56:42 UTC

Technical Analysis

The 'chai-as-persisted' npm package contains a postinstall script that executes 'index.js', which spawns a detached child process running 'lib/initializeCaller.js'. This module hides a base64-encoded C2 URL in fabricated environment variables to evade detection. At install time, it decodes the URL, sends a POST request to it, and executes the response as JavaScript with full Node.js module access via 'new Function.constructor'. This results in remote code execution on the installer's machine. The package is a deliberate typosquat of 'chai-as-promised' with unrelated malicious code masquerading as a logger middleware.

Potential Impact

Any system that installs or runs this package is fully compromised due to the execution of attacker-controlled code with full Node.js access. This can lead to unauthorized access, data theft, and persistent backdoors. All secrets and keys stored on the compromised system should be considered exposed and must be rotated immediately. Removing the package does not guarantee removal of all malicious artifacts or backdoors.

Mitigation Recommendations

Remove the 'chai-as-persisted' package immediately from all affected systems. Rotate all secrets and keys that were stored or accessible on the compromised machines using a secure, unaffected environment. Because the attacker gains full control during installation, assume the system is fully compromised and consider rebuilding or thoroughly auditing the environment. There is no official patch or fix for this malicious package; prevention relies on avoiding installation of typosquatting packages and verifying package authenticity.

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-6544
Osv Schema Version
1.7.4
Aliases
["GHSA-4wm6-vmww-2544"]
Ecosystems
["npm"]
Database Specific Severity
null
Cvss Version
null

Threat ID: 6a4452f127e9c797198f5108

Added to database: 06/30/2026, 23:36:17 UTC

Last enriched: 06/30/2026, 23:56:42 UTC

Last updated: 07/28/2026, 13:52:14 UTC

Views: 17

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