Malicious code in react-me (npm) - MAL-2024-2935
Summary
MAL-2024-2935: Malicious code in @hotwire/react-me (npm). Affects @hotwire/react-me versions 100.100.100. 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 package under scrutiny is @hotwire/react-me, an npm package. It is a library that provides components and utilities for building user interfaces using React. The package is widely used in web development projects and offers various features and functionalities to enhance the user experience. However, it has been identified that this package contains malicious code, which poses a security risk to applications that utilize it.
Vulnerability Detail
The vulnerability identified in @hotwire/react-me (npm) is due to the presence of malicious code. The origin of this code is currently attributed to a specific source, ReversingLabs. The malicious code has been detected in version 100.100.100 of the package. The code can potentially lead to unauthorized access, data breaches, or other malicious activities within the affected applications. It is crucial to address this vulnerability promptly to ensure the security and integrity of the application.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall @hotwire/react-me
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, developers can consider using an alternative package that provides similar functionality and is not affected by this vulnerability. It is important to thoroughly evaluate the alternative package for security and compatibility before implementing it in the application. Here is an example of how to use an alternative package, such as react-ui-library:
// Install the alternative package
npm install react-ui-library
// Import and use components from the alternative package
import { Button, Modal } from 'react-ui-library';
// Implement the components in your application
<Button onClick={handleClick}>Click me</Button>
<Modal isOpen={isOpen} onClose={handleClose}>Modal content</Modal>
Conclusion
The presence of malicious code in @hotwire/react-me (npm) poses a significant security risk to applications that utilize this package. It is crucial for developers to promptly address this vulnerability by updating to a version of the package that is not affected by the malicious code. Additionally, considering alternative packages and following best practices for package management and security can help mitigate the risk of similar vulnerabilities in the future.
See every vulnerability recorded for @hotwire/react-me →
FAQ
This vulnerability can potentially lead to unauthorized access, data breaches, or other malicious activities within the affected applications. It is crucial to address this vulnerability promptly to ensure the security and integrity of the application.
You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities in software using package-lock.json. Simply input your package-lock.json file in the playground to check for any vulnerabilities.
Yes, a fix is available for this vulnerability. It is recommended to update the @hotwire/react-me package to a version that is not affected by the malicious code. The maintainers of the package should release a patched version that removes the malicious code and ensures the security of the package.
As a temporary workaround, developers can consider using an alternative package that provides similar functionality and is not affected by this vulnerability. It is important to thoroughly evaluate the alternative package for security and compatibility before implementing it in the application.
To prevent similar vulnerabilities in the future, it is important to follow best practices for package management and security. Regularly update packages to the latest versions, monitor for security advisories, and conduct thorough security assessments of third-party packages before integrating them into your application.