Vulnerability in sharp package: sharp vulnerability in libwebp dependency CVE-2023-4863
Summary
GHSA-54xq-cgqr-rpm3: sharp vulnerability in libwebp dependency CVE-2023-4863. Affects sharp versions < 0.32.6. Fixed in 0.32.6. 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 sharp package is an npm package that is commonly used for processing images in Node.js applications. It relies on the libwebp library to decode WebP images. However, versions of sharp prior to 0.32.6 are vulnerable to a high severity vulnerability (CVE-2023-4863) in the libwebp dependency.
Vulnerability Detail
The vulnerability in sharp arises from the use of outdated versions of libwebp. This vulnerability can be exploited by an attacker who provides malicious WebP images as input to the sharp package. The impact of this vulnerability can be severe, potentially leading to remote code execution or denial of service attacks. It is crucial for users of sharp to upgrade to the latest version (0.32.6) to mitigate this vulnerability.
How To Fix
Minimum fixed version
0.32.6
This is the first release that contains the fix.
npm install sharp@0.32.6
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading sharp or libvips is not immediately feasible, a temporary workaround can be implemented by adding the following code snippet to the application:
sharp.block({ operation: ["VipsForeignLoadWebp"] });
This code will prevent sharp from decoding WebP images, thereby mitigating the vulnerability. However, it is still recommended to upgrade to the latest versions as soon as possible.
Conclusion
The sharp package has a vulnerability in its libwebp dependency that can be exploited by providing malicious WebP images. To mitigate this vulnerability, it is crucial to upgrade to the latest version of sharp (0.32.6) or ensure the use of the latest libwebp version (1.3.2). A temporary workaround is available, but it is recommended to apply the permanent fix by upgrading the package. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for sharp →
FAQ
Sharp is an npm package used for image processing in Node.js applications. It provides a high-performance and memory-efficient API for manipulating images.
Libwebp is a library for decoding and encoding WebP images. It is used by sharp to handle WebP image formats.
The vulnerability in sharp can allow an attacker to execute arbitrary code or cause denial of service attacks by providing malicious WebP images as input.
To fix this vulnerability, it is recommended to upgrade sharp to the latest version (0.32.6) or ensure that the latest version of libwebp (1.3.2) is being used.
Yes, a temporary workaround is available by adding the provided code snippet to prevent sharp from decoding WebP images. However, upgrading to the latest versions is still recommended.
References
Related vulnerabilities
Recent vulnerabilities recorded for sharp.
Follow Vulert in Google
Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.