Critical Double Free Vulnerability in GD Package: Remote Code Execution Risk
Summary
ALPINE-CVE-2018-1000222: Libgd version 2.2.5 contains a Double Free Vulnerability vulnerability in gdImageBmpPtr Function that can result in Remote Code Execution . Affects gd versions < 2.2.5-r1. Fixed in 2.2.5-r1. 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 GD package is a widely used library for the dynamic creation of images in various formats, including PNG, JPEG, and GIF. It is commonly utilized in web applications for image processing tasks. The library provides developers with the ability to manipulate images on the server side, making it an essential tool for many PHP applications. However, a critical vulnerability has been identified in version 2.2.5, which could allow attackers to exploit the library through specially crafted JPEG images.
Vulnerability Detail
Libgd version 2.2.5 contains a Double Free Vulnerability in the gdImageBmpPtr function. This vulnerability can lead to Remote Code Execution (RCE), allowing an attacker to execute arbitrary code on the server. The issue arises from improper memory management, where the same memory is freed multiple times, potentially leading to exploitation. The vulnerability was introduced in earlier versions and has been fixed in subsequent releases after commit ac16bdf2d41724b5a65255d4c28fb0ec46bc42f5.
How To Fix
Minimum fixed version
2.2.5-r1
This is the first release that contains the fix.
sudo apk add --upgrade gd
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If an immediate update is not feasible, consider disabling image processing features that utilize the GD library until the patch can be applied. This may involve modifying your application code to bypass image handling functionalities temporarily.
Conclusion
The identified double free vulnerability in the GD package poses a significant risk of remote code execution. It is crucial for developers to update to the patched version 2.2.5-r1 to mitigate this risk. Additionally, utilizing tools like Vulert can help in monitoring and managing vulnerabilities in open-source software effectively.
See every vulnerability recorded for gd →
FAQ
The CVSS score for this vulnerability is 8.8, indicating a high severity level.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.
If exploited, this vulnerability could allow an attacker to execute arbitrary code on the server, potentially leading to data breaches or complete system compromise.
Yes, Vulert can monitor and alert you in real-time for open-source vulnerabilities in your software using just a manifest file like package-lock.json.
If an immediate update is not possible, consider disabling features that rely on the GD library until you can apply the patch.
References
Related vulnerabilities
Recent vulnerabilities recorded for gd.