Malicious Code Detected in compare-obj Package - Critical Security Alert
Summary
MAL-2025-190950: Malicious code in compare-obj (npm). Affects compare-obj versions 1.1.1 – 1.1.2. 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 compare-obj package is a utility for comparing JavaScript objects, often used in applications to determine differences between data structures. It is popular in the npm ecosystem due to its simplicity and effectiveness. However, a recent discovery has revealed that this package contains malicious code, posing significant security risks to any application that utilizes it.
Vulnerability Detail
The vulnerability originates from the compare-obj package, which has been identified to contain embedded malicious code. This code can compromise the security of any system where the package is installed, potentially allowing unauthorized access to sensitive data, including secrets and keys. The malicious nature of the code means that any system running this package should be considered fully compromised, necessitating immediate action to mitigate risks.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall compare-obj
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 avoid using the compare-obj package altogether and implement your own object comparison logic or use an alternative library that does not have known vulnerabilities.
Conclusion
The discovery of malicious code in the compare-obj package highlights the importance of vigilance in managing open-source dependencies. Immediate action is required to mitigate risks associated with this vulnerability. By uninstalling the affected package and utilizing tools like Vulert, developers can better protect their applications from potential threats.
See every vulnerability recorded for compare-obj →
FAQ
You should immediately uninstall the compare-obj package and rotate any secrets or keys stored on the affected system.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check your application without needing to sign up.
Failing to address this vulnerability can lead to unauthorized access to sensitive data, potential data breaches, and complete system compromise.
Regularly audit your dependencies, use tools like Vulert for real-time monitoring, and keep your packages updated to the latest secure versions.
While many npm packages are safe, it's essential to perform due diligence by reviewing package sources, checking for known vulnerabilities, and using monitoring tools like Vulert.