Malicious Code Vulnerability in cookie-validate Package
Summary
MAL-2025-191569: Malicious code in cookie-validate (npm). Affects cookie-validate versions 2.2.4. 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 cookie-validate package is an npm library designed to validate cookie values in web applications, ensuring that they conform to expected formats and security standards. It is widely used in Node.js applications to enhance security by preventing cookie-related vulnerabilities. However, the package has recently been compromised, leading to the introduction of malicious code that could potentially harm applications using it.
Vulnerability Detail
The vulnerability identified in the cookie-validate package stems from the introduction of malicious code in version 2.2.4. This code could allow attackers to execute arbitrary commands or access sensitive data, posing significant risks to applications that rely on this package. The malicious code was discovered through a security audit and is linked to a specific commit in the package's repository, indicating that it was intentionally introduced.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall cookie-validate
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
If immediate updating is not feasible, consider removing the cookie-validate package temporarily and replacing it with an alternative validation library until a secure version is available. You can also implement custom cookie validation logic to mitigate risks.
Conclusion
The cookie-validate package has been compromised, leading to a significant vulnerability that could affect applications using it. It is essential to update to the latest version to mitigate risks. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.
See every vulnerability recorded for cookie-validate →
FAQ
cookie-validate is an npm library used for validating cookie values in web applications, ensuring they meet security standards.
The malicious code was introduced in version 2.2.4 of the cookie-validate package, likely through a compromised commit.
The risks include potential unauthorized access to sensitive data and the ability for attackers to execute arbitrary commands within the application.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check if your application is affected without needing to sign up.
Consider removing the cookie-validate package temporarily and using an alternative validation library or implementing custom cookie validation logic.