Critical Vulnerability in GD Package: Integer Signedness Error Leading to Infinite Loop
Summary
ALPINE-CVE-2018-5711: gd_gif_in.c in the GD Graphics Library (aka libgd), as used in PHP before 5.6.33, 7.0.x before 7.0.27, 7.1.x before 7.1.13, and 7.2.x before 7.2.1, has an integer signedness error that leads to an infinite loop via a cra... Affects gd versions < 2.2.5-r2. Fixed in 2.2.5-r2. 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 graphics library that enables developers to create and manipulate images dynamically. It supports various image formats and is commonly integrated into web applications, particularly those using PHP. However, the GD library has been found to have a significant vulnerability that can be exploited through crafted GIF files, potentially leading to application crashes or denial of service.
Vulnerability Detail
The vulnerability arises from an integer signedness error in the gd_gif_in.c file of the GD Graphics Library. This flaw affects versions of PHP prior to 5.6.33, 7.0.x before 7.0.27, 7.1.x before 7.1.13, and 7.2.x before 7.2.1. An attacker can exploit this vulnerability by sending a specially crafted GIF file to the application, which can cause an infinite loop when the imagecreatefromgif or imagecreatefromstring functions are called. This can lead to resource exhaustion and potentially crash the application, impacting availability.
How To Fix
Minimum fixed version
2.2.5-r2
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 immediate patching is not possible, consider disabling the functionality that processes GIF files or implementing strict validation on the input files to prevent malicious GIFs from being processed.
Conclusion
The GD package vulnerability presents a significant risk to applications that utilize it for image processing. By understanding the nature of the vulnerability and taking appropriate steps to update the package, developers can protect their applications from potential exploitation. Utilizing tools like Vulert can further enhance security by providing real-time monitoring for vulnerabilities.
See every vulnerability recorded for gd →
FAQ
The CVSS score of this vulnerability is 5.5, indicating a medium severity level.
Affected versions include PHP versions prior to 5.6.33, 7.0.x before 7.0.27, 7.1.x before 7.1.13, and 7.2.x before 7.2.1.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring access to the code or installation.
Exploitation of this vulnerability can lead to an infinite loop, causing resource exhaustion and potentially crashing the application, resulting in denial of service.
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.
References
Related vulnerabilities
Recent vulnerabilities recorded for gd.