CVE-2019-6977Libgd Heap Buffer Overflow
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.
Published Jan 27, 2019 · Updated Nov 3, 2026 · Also known as ALPINE-CVE-2019-6977, CLEANSTART-2024-ZW00851, 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, MGASA-2019-0073, 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, openSUSE-SU-2019:1148-1, openSUSE-SU-2024:11852-1
Key Facts
Patch immediately- CVE-2019-6977 is a medium-severity vulnerability (CVSS 6.3 v3.1) affecting Libgd, Storage Automation Store (Netapp), PHP and 22 more products.
- It is not listed in any known-exploited vulnerabilities catalog. A public exploit is reported by tracking sources, but no code link is listed yet.
- 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.
Scores
CVSS v3.1
6.3
CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
EPSS (30-day exploit likelihood)
71%
Higher than 99.4% of all scored CVEs
Exploit maturity
Proof of concept
ATLAS score
46/100
Publication score, see How it works
Exploitation Verdict
KEV listed
Not listed
Federal due date
None
No federal due date
Ransomware use
Not reported
Attributed actors
None named
Exploit & Defence Guidance
Exploit maturity
Proof of concept
Public exploit code
1
Proof-of-concept links
In-the-wild evidence
1
Reports of active use
Advisories And Exploit References
- advisoryhttps://security.alpinelinux.org/vuln/CVE-2019-6977
- advisoryhttps://security-tracker.debian.org/tracker/CVE-2019-6977
- advisoryhttps://ubuntu.com/security/CVE-2019-6977
- advisoryhttps://www.cve.org/CVERecord?id=CVE-2019-6977
- advisoryhttp://php.net/ChangeLog-5.php
- advisoryhttp://php.net/ChangeLog-7.php
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
463 affected entries in total| Product | Affected versions | Fixed in |
|---|---|---|
| LibgdLibgd | 2.2.5 | 2.2.5-2.3.mga6 |
| 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, 5.3.3-50.el6_10.tuxcare.ol.els20
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-2.3.mga6, 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.3.3-50.el6_10.tuxcare.ol.els20, 5.6.40
php-bcmath
5.3.3-50.el6_10.tuxcare.ol.els20
php-cli
5.3.3-50.el6_10.tuxcare.ol.els20
php-common
5.3.3-50.el6_10.tuxcare.ol.els20
php-dba
5.3.3-50.el6_10.tuxcare.ol.els20
php-devel
5.3.3-50.el6_10.tuxcare.ol.els20
php-embedded
5.3.3-50.el6_10.tuxcare.ol.els20
php-enchant
5.3.3-50.el6_10.tuxcare.ol.els20
php-fpm
5.3.3-50.el6_10.tuxcare.ol.els20
php-imap
5.3.3-50.el6_10.tuxcare.ol.els20
php-intl
5.3.3-50.el6_10.tuxcare.ol.els20
php-ldap
5.3.3-50.el6_10.tuxcare.ol.els20
php-mbstring
5.3.3-50.el6_10.tuxcare.ol.els20
Timeline
Publicly disclosed
Jan 27, 2019
Last updated
Nov 3, 2026
Weakness Type
- CWE-122 Heap-based Buffer Overflow
- CWE-787 Out-of-bounds Write
References
- advisorysecurity.alpinelinux.org · CVE-2019-6977
- advisorysecurity-tracker.debian.org · CVE-2019-6977
- advisoryubuntu.com · CVE-2019-6977
- advisorycve.org · CVERecord
- advisoryphp.net · ChangeLog-5.php
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.
A public exploit is reported by tracking sources, but no code link is listed yet.
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 On Your Attack Surface?
Brandefense matches it against the products discovered on your perimeter and opens a finding the day a CVE like this is listed.
Request A Demo