CVE-2019-6977
HighPublic exploitgdImageColorMatch in gd_color_match.c in the GD Graphics Library (aka LibGD) 2.2.5, as used in the imagecolormatch function in PHP before 5.6.40, 7.x before 7.1.26, 7.2.x before 7.2.14, and 7.3.x before 7.3.1, has a heap-based buffer overflow.
Published Jan 27, 2019 · Updated Aug 7, 2026 · Also known as ALPINE-CVE-2019-6977, DEBIAN-CVE-2019-6977, DEBIAN-CVE-2019-9020, DEBIAN-CVE-2019-9021, DEBIAN-CVE-2019-9023, DEBIAN-CVE-2019-9024, DLA-1679-1, DSA-4384-1, SUSE-SU-2019:0449-1, SUSE-SU-2019:0747-1, SUSE-SU-2019:0771-1, SUSE-SU-2019:13961-1, UBUNTU-CVE-2019-6977, USN-3900-1
Key Facts
Patch immediately- CVE-2019-6977 is a high-severity vulnerability (CVSS 8.8 v3.1) affecting Libgd, Storage Automation Store (Netapp), PHP and 22 more products.
- It is not listed in any known-exploited vulnerabilities catalog. Public exploit code is available.
- EPSS estimates a 71% probability of exploitation in the next 30 days.
- Fixed versions are available, including apache2-mod_php5 5.5.14-109.48.1, apache2-mod_php5 5.5.14-112.1, apache2-mod_php53 5.3.17-112.53.1.
- Brandefense priority: patch immediately, because it is very likely to be exploited soon.
CVSS v3.1
8.8
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS (30-day exploit likelihood)
71%
Higher than 99.4% of all scored CVEs
Exploited in the wild
No known
Not in a known-exploited catalog
Public exploit code
Available
Proof-of-concept or weaponized module
Get the full CVE-2019-6977 brief as a PDF
Every affected product and fixed release, exploitation status and a first 24 hours response checklist, emailed within minutes.
Description
gdImageColorMatch in gd_color_match.c in the GD Graphics Library (aka LibGD) 2.2.5, as used in the imagecolormatch function in PHP before 5.6.40, 7.x before 7.1.26, 7.2.x before 7.2.14, and 7.3.x before 7.3.1, has a heap-based buffer overflow. This can be exploited by an attacker who is able to trigger imagecolormatch calls with crafted image data.
Affected Products
430 affected entries in total| Product | Affected versions | Fixed in |
|---|---|---|
| LibgdLibgd | 2.2.5 | 2.2.5-4.ph2 |
| Storage Automation StoreNetapp | See advisory | n/a |
| PHPPHP | 7.3.0 | 5.6.40 |
| Ubuntu LinuxCanonical | 14.04, 16.04, 18.04, 18.10 | n/a |
| Debian LinuxDebian | 8.0, 9.0 | n/a |
Patched Releases
apache2-mod_php5
5.5.14-109.48.1, 5.5.14-112.1
apache2-mod_php53
5.3.17-112.53.1
apache2-mod_php7
7.0.7-50.63.1, 7.0.7-55.1
gd
0:2.2.5-7.el8, 2.0.35-27.el7_9+sp999, 2.1.0-24.12.1, 2.1.0-30.1, 2.2.5-2, 2.2.5-4.6.1, 2.2.5-7.el8, 2.2.5-lp150.8.1, 2.2.5-r2, 2.3.3-1.1
gd-32bit
2.1.0-24.12.1, 2.1.0-30.1
gd-devel
2.1.0-24.12.1, 2.1.0-30.1, 2.2.5-4.6.1, 2.2.5-7.el8, 2.2.5-lp150.8.1, 2.3.3-1.1
gd-devel-32bit
2.3.3-1.1
Libgd
2.2.5-4.ph2, 2.2.5-4.ph3
libgd2
2.1.0-3ubuntu0.11, 2.1.0-5+deb8u12, 2.1.1-4ubuntu0.16.04.11, 2.2.4-2+deb9u4, 2.2.5-4ubuntu0.3, 2.2.5-5.1
libgd3
2.2.5-4.6.1, 2.2.5-lp150.8.1, 2.3.3-1.1
libgd3-32bit
2.2.5-lp150.8.1, 2.3.3-1.1
perl-GD
2.76-1.1
PHP
5.6.40
php5
5.5.14-109.48.1, 5.5.14-112.1, 5.6.40+dfsg-0+deb8u1
php5-bcmath
5.5.14-109.48.1, 5.5.14-112.1
php5-bz2
5.5.14-109.48.1, 5.5.14-112.1
php5-calendar
5.5.14-109.48.1, 5.5.14-112.1
php5-ctype
5.5.14-109.48.1, 5.5.14-112.1
php5-curl
5.5.14-109.48.1, 5.5.14-112.1
php5-dba
5.5.14-109.48.1, 5.5.14-112.1
php5-devel
5.5.14-109.48.1, 5.5.14-112.1
php5-dom
5.5.14-109.48.1, 5.5.14-112.1
php5-enchant
5.5.14-109.48.1, 5.5.14-112.1
php5-exif
5.5.14-109.48.1, 5.5.14-112.1
php5-fastcgi
5.5.14-109.48.1, 5.5.14-112.1
Timeline
Publicly disclosed
Jan 27, 2019
Last updated
Aug 7, 2026
Weakness Type
- CWE-122 Heap-based Buffer Overflow
- CWE-787 Out-of-bounds Write
References
- advisoryhttp://php.net/ChangeLog-5.php
- advisoryhttp://php.net/ChangeLog-7.php
- advisoryRHSA-2020:4659
- advisoryhttps://bugzilla.suse.com/1118832
- advisoryhttps://bugzilla.suse.com/1123354
FAQ
Common Questions.
gdImageColorMatch in gd_color_match.c in the GD Graphics Library (aka LibGD) 2.2.5, as used in the imagecolormatch function in PHP before 5.6.40, 7.x before 7.1.26, 7.2.x before 7.2.14, and 7.3.x before 7.3.1, has a heap-based buffer overflow.
Affected: Libgd versions 2.2.5; Storage Automation Store (Netapp); PHP versions 7.3.0, among others. The full list is in the CVE brief.
It is not listed in any known-exploited vulnerabilities catalog.
No, it is not currently listed in the CISA Known Exploited Vulnerabilities catalog.
Public exploit code is available.
Fixed versions are available, including apache2-mod_php5 5.5.14-109.48.1, apache2-mod_php5 5.5.14-112.1, apache2-mod_php53 5.3.17-112.53.1.
Brandefense priority: patch immediately, because it is very likely to be exploited soon.
Is CVE-2019-6977 Running On Your Attack Surface?
Brandefense maps vulnerabilities like this one to your internet-facing assets and tells you exactly where to patch.
Request A Demo