Critical Malicious Code Vulnerability in chai-as-approved Package
Summary
MAL-2026-832: Malicious code in chai-as-approved (npm). Affected versions are not published. No fix is published. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
The chai-as-approved package is a JavaScript library used in Node.js applications for testing and assertions. It is designed to enhance the capabilities of the Chai assertion library, allowing developers to write more expressive tests. However, this package has been found to contain malicious code that compromises the security of systems where it is installed.
Vulnerability Detail
The vulnerability originates from the inclusion of malicious code within the chai-as-approved package. This code can fully compromise any computer that has the package installed, leading to potential data breaches and unauthorized access to sensitive information. The malicious code can manipulate system operations, making it difficult to remove all traces of the compromise even after the package is uninstalled. Users are advised to treat any system with this package as fully compromised.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall chai-as-approved
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 workaround, ensure that you do not run any applications that depend on the chai-as-approved package until it has been removed. Additionally, consider using alternative packages that provide similar functionality without the associated risks.
Conclusion
The discovery of malicious code within the chai-as-approved package poses a serious threat to users and their systems. Immediate action is required to mitigate the risks associated with this vulnerability. Users should uninstall the package, rotate sensitive information, and consider using alternative libraries for their testing needs.
See every vulnerability recorded for chai-as-approved →
FAQ
You should uninstall the package immediately and rotate any sensitive information stored on the affected system.
You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without requiring any signup.
While removing the package is crucial, there is no guarantee that all malicious software will be removed. It is recommended to perform a thorough security audit and consider reinstalling the operating system if necessary.
Leaving the package installed poses significant risks, including unauthorized access to sensitive data, potential data breaches, and complete control of your system by malicious actors.
Yes, consider using other assertion libraries that do not have known vulnerabilities, such as the standard Chai library or other well-reviewed testing frameworks.