Skip to main content

Malicious code in chai-as-structured (npm)

0
Critical
Published: 07/14/2026 (07/14/2026, 20:33:52 UTC)
Source: GCVE Database
Product: chai-as-structured

Description

The npm package 'chai-as-structured' version 7.0.5 is a malicious package designed to perform a supply-chain attack. It masquerades as a legitimate package but executes a detached Node.js child process that fetches and executes remote code with full Node privileges. The remote code is concealed using base64 encoding and is fetched from an anonymous file-hosting site. This behavior is consistent with intentional malicious activity rather than legitimate functionality.

Affected software

npmghsa
chai-as-structured
Affected versions
=7.0.5

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/08/2026, 09:08:27 UTC

Technical Analysis

The 'chai-as-structured' package (version 7.0.5) is a typosquatting malicious npm package that impersonates a legitimate package but contains harmful code. When its middleware factory is invoked, it spawns a detached Node.js child process running 'lib/initializeCaller.js'. This script creates a fake environment variable stub with base64-encoded fields that decode to a URL and request headers targeting an anonymous file-hosting service. The response includes a cookie string that is executed dynamically with full Node.js privileges via 'new Function.constructor', enabling arbitrary code execution. The use of base64 concealment, misleading environment variable names, detached child processes, and typosquatting techniques indicate a deliberate supply-chain attack.

Potential Impact

This malicious package allows remote code execution with full Node.js privileges by fetching and executing arbitrary code from a remote anonymous host. This can lead to compromise of the host environment where the package is installed, potentially exposing sensitive data, enabling further attacks, or causing system disruption.

Mitigation Recommendations

No official patch or remediation is currently documented. Users should immediately remove the 'chai-as-structured' package version 7.0.5 from their projects and replace it with a verified legitimate package. Avoid installing packages with suspicious or typosquatting names. Monitor for any unexpected child processes or network connections originating from Node.js processes. Check vendor advisories or trusted security sources for updates on remediation or detection.

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-10622
Osv Schema Version
1.7.4
Aliases
["GHSA-wf75-6wm5-v349"]
Ecosystems
["npm"]

Threat ID: 6a96f319acd9273b49e49725

Added to database: 09/01/2026, 15:45:29 UTC

Last enriched: 09/08/2026, 09:08:27 UTC

Last updated: 10/04/2026, 04:18:27 UTC

Views: 33

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