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-doc (npm)

0
Critical
Published: 07/10/2026 (07/10/2026, 21:24:50 UTC)
Source: GCVE Database
Product: chai-as-doc

Description

--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (cecfd3091225b3667317dd9da8fd56c4f5e7fc675e17d52cda601898b3a50ec2) The package presents itself as pino-style logging middleware but on require() spawns a detached Node child that runs lib/initializeCaller.js. That script base64-decodes a hardcoded URL (stored as a fake DEV_API_KEY constant) resolving to https://ipcheck-hashed.vercel.app/api/auth/6c1d60d35852ef0c05df, POSTs the entire process.env object to it with an x-secret-header, and then passes the HTTP response body to `new Function("require", response.data)` and invokes it with the local require. This gives the remote host arbitrary code execution inside the installer's Node process with full environment/credential access. The base64 obfuscation of the endpoint, the disguised middleware cover story, and the name resembling chai/chai-as-promised are consistent with a typosquat supply-chain attack.

Affected software

npmghsa
chai-as-doc
Affected versions
=2.3.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: 07/11/2026, 09:47:47 UTC

Technical Analysis

The malicious npm package chai-as-doc (version 2.3.5) performs a supply-chain attack by executing hidden code upon require(). It spawns a detached Node child process running lib/initializeCaller.js, which base64-decodes a hardcoded URL and POSTs the entire process.env object to that remote endpoint with a secret header. The HTTP response body is then executed dynamically using new Function, passing the local require, allowing the remote host to execute arbitrary code with full environment and credential access. The package name and behavior indicate a typosquatting attempt targeting developers expecting chai or chai-as-promised packages.

Potential Impact

This vulnerability allows an attacker controlling the remote endpoint to execute arbitrary code within the Node.js process of the user installing or requiring the package. This includes access to all environment variables and credentials available to the process, potentially leading to credential theft, system compromise, or further malicious activity within the affected environment.

Mitigation Recommendations

No official patch or remediation is currently available. Users should avoid installing or using chai-as-doc version 2.3.5. Verify package names carefully to avoid typosquatting attacks and prefer official, well-maintained packages. Monitor for updates or advisories from trusted sources regarding this package.

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-10175
Osv Schema Version
1.7.4
Aliases
[]
Ecosystems
["npm"]
Database Specific Severity
null
Cvss Version
null

Threat ID: 6a520eaf68715ace438f4c97

Added to database: 07/11/2026, 09:36:47 UTC

Last enriched: 07/11/2026, 09:47:47 UTC

Last updated: 07/28/2026, 23:36:42 UTC

Views: 31

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