Critical Malicious Code Vulnerability in react-native-get-pixel-dimensions Package
Summary
MAL-2025-190998: Malicious code in react-native-get-pixel-dimensions (npm). Affects react-native-get-pixel-dimensions versions 1.0.1 – 1.0.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 react-native-get-pixel-dimensions package is a utility for React Native applications that helps developers retrieve pixel dimensions of UI elements. It is commonly used in mobile app development to ensure that layouts are responsive and visually appealing across different screen sizes. However, recent findings have revealed that this package contains malicious code, posing significant security risks to applications that utilize it.
Vulnerability Detail
The vulnerability originates from the inclusion of malicious code within the react-native-get-pixel-dimensions package, specifically in versions 1.0.1 and 1.0.2. This malicious code can compromise any computer that has the package installed, allowing unauthorized access to sensitive information such as secrets and keys. The ramifications of this vulnerability are severe, as it could lead to complete control of the affected system by an external entity, making it imperative for users to take immediate action.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall react-native-get-pixel-dimensions
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, users can temporarily replace the functionality provided by react-native-get-pixel-dimensions with alternative methods for obtaining pixel dimensions, such as using the built-in Dimensions API from React Native. Example code:
const { width, height } =
Dimensions.
get('window');
Conclusion
The react-native-get-pixel-dimensions package has been identified as containing malicious code, which poses serious security threats to systems using it. Immediate removal of the package is necessary to mitigate risks, and users should monitor for any updates or patches in the future.
See every vulnerability recorded for react-native-get-pixel-dimensions →
FAQ
You should remove the package immediately and consider rotating any sensitive information stored on the affected system.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Visit Vulert Scanner to check your application without any signup.
Currently, there are no patched versions available for the react-native-get-pixel-dimensions package. Removal is the recommended action.
Failing to address this vulnerability could lead to unauthorized access to sensitive data and complete control of your system by malicious actors.
You should seek alternative methods for obtaining pixel dimensions, as the package is compromised and poses security risks.