Skip to content
OpenAdvisories
Unscored Public exploit CVE-2019-6977 EUVD-2019-16529GHSA-3jrx-xgc5-h2f9

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…

Published Jan 27, 2019 · Updated Aug 4, 2024 · Assigned by mitre

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.

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 libgd2 2.2.5-5.1 —
Debian 13 libgd2 2.2.5-5.1 —
Debian 12 libgd2 2.2.5-5.1 —
Debian 9 libgd2 2.2.4-2+deb9u4 DSA-4384-1
Debian 8 libgd2 2.1.0-5+deb8u12 DLA-1651-1
Debian 8 php5 5.6.40+dfsg-0+deb8u1 DLA-1679-1
ReleasePackageFixed inAdvisory
Ubuntu 18.04 LTS libgd2 2.2.5-4ubuntu0.3 USN-3900-1
Ubuntu 16.04 LTS libgd2 2.1.1-4ubuntu0.16.04.11 USN-3900-1
Ubuntu 14.04 LTS libgd2 2.1.0-3ubuntu0.11 USN-3900-1
ReleasePackageFixed inAdvisory
RHEL 8 gd +1 2.2.5-7.el8 RHSA-2020:4659
RHEL 3 rh-php71-php +27 7.1.30-1.el7 RHSA-2019:2519
RHEL 3 rh-php72-php +27 7.2.24-1.el7 RHSA-2019:3299

AlmaLinux

Errata ↗
ReleasePackageFixed inAdvisory
AlmaLinux 8 gd +1 2.2.5-7.el8 ALSA-2020:4659

Rocky Linux

Errata ↗
ReleasePackageFixed inAdvisory
Rocky Linux 8 gd 2.2.5-7.el8 RLSA-2020:4659
ReleasePackageFixed inAdvisory
SLES 15 gd 2.2.5-4.6.1 SUSE-SU-2019:0771-1
SLES 12 SP4 gd 2.1.0-24.12.1 SUSE-SU-2019:0747-1
SLES 12 SP4 php5 5.5.14-109.48.1 SUSE-SU-2019:0449-1
SLES 12 SP4 php7 7.0.7-50.63.1 SUSE-SU-2019:0333-1
SLES 12 SP3 gd 2.1.0-24.12.1 SUSE-SU-2019:0747-1
SLES 12 SP3 php5 5.5.14-109.48.1 SUSE-SU-2019:0449-1
SLES 12 SP3 php7 7.0.7-50.63.1 SUSE-SU-2019:0333-1
SLES 12 php5 5.5.14-109.48.1 SUSE-SU-2019:0449-1
SLES 12 php7 7.0.7-50.63.1 SUSE-SU-2019:0333-1
SLES 11 SP4 php53 5.3.17-112.53.1 SUSE-SU-2019:13961-1
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 12 SP4 gd 2.1.0-24.12.1 SUSE-SU-2019:0747-1
SLES for SAP 12 SP3 gd 2.1.0-24.12.1 SUSE-SU-2019:0747-1
SLES for SAP 11 SP4 php53 5.3.17-112.53.1 SUSE-SU-2019:13961-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed gd 2.3.3-1.1 openSUSE-SU-2024:10777-1
openSUSE Tumbleweed perl-GD 2.76-1.1 openSUSE-SU-2024:11852-1
openSUSE Leap 15.0 gd 2.2.5-lp150.8.1 openSUSE-SU-2019:1148-1
ReleasePackageFixed inAdvisory
Alpine v3.24 gd 2.2.5-r2 —
Alpine v3.23 gd 2.2.5-r2 —
Alpine v3.22 gd 2.2.5-r2 —
Alpine v3.21 gd 2.2.5-r2 —
Alpine v3.20 gd 2.2.5-r2 —
Show 14 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 gd 2.2.5-r2 —
Alpine v3.18 gd 2.2.5-r2 —
Alpine v3.17 gd 2.2.5-r2 —
Alpine v3.16 gd 2.2.5-r2 —
Alpine v3.15 gd 2.2.5-r2 —
Alpine v3.14 gd 2.2.5-r2 —
Alpine v3.13 gd 2.2.5-r2 —
Alpine v3.12 gd 2.2.5-r2 —
Alpine v3.11 gd 2.2.5-r2 —
Alpine v3.10 gd 2.2.5-r2 —
Alpine v3.9 gd 2.2.5-r2 —
Alpine v3.8 gd 2.2.5-r2 —
Alpine v3.7 gd 2.2.5-r2 —
Alpine v3.7 php7 7.1.29-r0 —
Alpine v3.6 gd 2.2.5-r2 —

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 8 gd +1 2.2.5-7.el8 ELSA-2020-4659

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

Exploit-DB 1

GitHub 1 repository

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Advisories 18

References