Malicious Code Vulnerability in chai-as-tested: npm Package Compromised
Summary
MAL-2025-192723: Malicious code in chai-as-tested (npm). Affects chai-as-tested versions 2.3.8. 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
chai-as-tested is a popular npm package that extends the Chai assertion library, allowing developers to write tests in a more expressive manner. It is widely used in JavaScript testing environments to facilitate behavior-driven development (BDD). However, recent findings have revealed that this package has been compromised, introducing malicious code that could potentially harm applications relying on it.
Vulnerability Detail
The vulnerability identified in chai-as-tested is characterized by the presence of malicious code that can execute unauthorized actions within the user's environment. This issue originated from a compromised version of the package, specifically version 2.3.8, which was identified by ReversingLabs. The ramifications of this vulnerability include potential data breaches, unauthorized access to sensitive information, and the risk of further exploitation by attackers. Developers using this package are urged to take immediate action to mitigate these risks.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall chai-as-tested
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, you can remove the chai-as-tested package from your project until a secure version is released. You can do this by running the following command: npm uninstall chai-as-tested. Alternatively, consider using a different assertion library that does not have known vulnerabilities.
Conclusion
The discovery of malicious code in the chai-as-tested npm package poses significant risks to developers and their applications. Immediate action is required to update or remove the affected package to safeguard against potential exploitation. Utilizing tools like Vulert can help monitor for such vulnerabilities in real-time.
See every vulnerability recorded for chai-as-tested →
FAQ
chai-as-tested is an npm package that extends the Chai assertion library, enabling developers to write expressive tests for JavaScript applications.
The vulnerability was discovered by ReversingLabs, which identified malicious code in version 2.3.8 of the chai-as-tested package.
The risks include unauthorized access to sensitive data, potential data breaches, and the possibility of further exploitation by malicious actors.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. By utilizing the Vulert playground, you can check if your application is affected without any signup.
If immediate updates are not feasible, consider removing the package or using an alternative library until a secure version is available.