Critical Vulnerability in GD Package: Integer Signedness Error Leading to Infinite Loop

gd Updated 02 Oct 2025

Summary

16/01/2018
N/A
Yes i
Medium
5.5

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 ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

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 →

Share this vulnerability

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.

Related vulnerabilities

Recent vulnerabilities recorded for gd.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback