Malicious Code Injection in chai-as-testmode: A Critical Vulnerability

chai-as-testmode Updated 05 Oct 2026

Summary

04/10/2026
CRITICAL
No i
Critical
Not published

MAL-2026-17473: Malicious code in chai-as-testmode (npm). Affects chai-as-testmode versions 1.4.7. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

chai-as-testmode is an npm package designed to facilitate testing in a controlled environment. It aims to provide developers with tools to simulate various testing scenarios. However, this package has been compromised, masquerading as a legitimate logging library while embedding malicious code that can expose sensitive environment variables.

Vulnerability Detail

The vulnerability originates from a malicious dropper included in the package, specifically in the lib/initializeCaller.js file. This dropper executes a self-invoking function that sends the entire process.env object to a concealed endpoint. The transmitted data may include sensitive tokens and credentials, which can be exploited by attackers. The malicious code is hidden behind a facade of legitimate documentation and package naming, making it difficult for users to detect.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

npm uninstall chai-as-testmode

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, consider removing the chai-as-testmode package from your project until a secure version is available. You can do this by executing: npm uninstall chai-as-testmode. Additionally, review your environment variables and rotate any exposed credentials.

Conclusion

The chai-as-testmode package has been compromised with a serious vulnerability that can lead to the exposure of sensitive environment variables. It is essential for developers to take immediate action by updating or removing the package to safeguard their applications.

See every vulnerability recorded for chai-as-testmode →

Share this vulnerability

FAQ

The vulnerability involves malicious code that sends sensitive environment variables to an external server, potentially exposing critical credentials.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Check your application against this vulnerability using the Vulert playground at Vulert Scanner.

If you have installed chai-as-testmode, immediately update to the latest patched version or uninstall the package to mitigate risks.

Yes, the vulnerability can expose various environment variables, including NPM_TOKEN, GITHUB_TOKEN, and AWS credentials, which are critical for your application's security.

The malicious code executes a function that sends the entire process environment to a base64-encoded endpoint, allowing attackers to retrieve sensitive information.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

npm uninstall chai-as-testmode

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback