Malicious Code Injection in chaienv Package: A Critical Security Risk

chaienv Updated 30 Sep 2026

Summary

30/09/2026
CRITICAL
No i
Critical
Not published

MAL-2026-17321: Malicious code in chaienv (npm). Affects chaienv versions 1.0.2. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The chaienv package, version 1.0.2, is designed as a helper for creating Chai environments in JavaScript applications. It aims to simplify the setup of testing environments but has been found to contain malicious code that poses significant security risks. The package's functionality is overshadowed by its vulnerability, which involves the unconditionally loading of an obfuscated and potentially harmful module.

Vulnerability Detail

The vulnerability stems from the chaienv package's index.js file, which loads lib/config.js at require time without any checks. This file is an extremely large, obfuscated module packed with malicious code, making it a significant security threat. The malicious code is designed to execute upon importing the package, potentially compromising any application that uses chaienv. The package also impersonates a well-known library, making it difficult for users to identify the threat during casual code reviews.

How To Fix

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

npm uninstall chaienv

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, avoid using the chaienv package and consider using alternative libraries for setting up Chai environments. If you must use chaienv, ensure to audit your code and monitor for any suspicious activity.

Conclusion

The chaienv package poses a significant security risk due to the presence of malicious code that executes upon import. It is essential to remove this package from your projects and monitor for any updates or patches. Utilizing tools like Vulert can help you stay informed about vulnerabilities in your software.

See every vulnerability recorded for chaienv →

Share this vulnerability

FAQ

chaienv is a small helper package designed to facilitate the setup of Chai testing environments in JavaScript applications.

The vulnerability allows malicious code to execute upon importing the chaienv package, potentially compromising your application's security and data.

Yes, you can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. You can check your application using the Vulert playground without any signup.

Remove the chaienv package from your project immediately and consider using alternative libraries for your testing needs.

Regularly audit your dependencies using tools like Vulert, which can provide real-time alerts for vulnerabilities in your software.

How To Fix

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

npm uninstall chaienv

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