Skip to content
Fencer Vulns
high 8.8

CVE-2016-5766 json

Integer overflow in the _gd2GetHeader function in gd_gd2.c in the GD Graphics Library (aka libgd) before 2.2.3, as used in PHP before 5.5.3…

published 2016-08-07 10 y ago modified 2026-06-17 4 mo ago also EUVD-2016-6701

cvss
8.8
version 3.0, NVD
cisa kev
Not listed
not in CISA's catalog
epss
7.5%
EPSS 7.5% chance of exploitation in 30 days, percentile 94%
public exploits
0
none known

Summary

Integer overflow in the _gd2GetHeader function in gd_gd2.c in the GD Graphics Library (aka libgd) before 2.2.3, as used in PHP before 5.5.37, 5.6.x before 5.6.23, and 7.x before 7.0.8, allows remote attackers to cause a denial of service (heap-based buffer overflow and application crash) or possibly have unspecified other impact via crafted chunk dimensions in an image.

Patch / fix

  • libgd2 Debian 14, Debian 13, Debian 12 2.2.2-29-g3c2b605-1

debian advisories DEBIAN-CVE-2016-5766

  • libgd2 Ubuntu 14.04 LTS 2.1.0-3ubuntu0.2
  • libgd2 Ubuntu 16.04 LTS 2.1.1-4ubuntu0.16.04.2

ubuntu advisories UBUNTU-CVE-2016-5766

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • rh-php56 RHEL 2 SOFTWARE_COLLECTIONS 2.3-1.el6
  • rh-php56 RHEL 2 SOFTWARE_COLLECTIONS 2.3-1.el7
  • rh-php56-php RHEL 2 SOFTWARE_COLLECTIONS 5.6.25-1.el6
  • rh-php56-php RHEL 2 SOFTWARE_COLLECTIONS 5.6.25-1.el7
  • rh-php56-php-gd RHEL 2 SOFTWARE_COLLECTIONS 5.6.25-1.el6
  • rh-php56-php-gd RHEL 2 SOFTWARE_COLLECTIONS 5.6.25-1.el7
  • rh-php56-php-cli RHEL 2 SOFTWARE_COLLECTIONS 5.6.25-1.el6
  • rh-php56-php-cli RHEL 2 SOFTWARE_COLLECTIONS 5.6.25-1.el7

red hat advisories RHSA-2016:2750RHSA-2020:5443RHSA-2016:2598

  • php53 SLES for SAP 11 SP4, SLES 11 SP4, SLE Software Development Kit 11 SP4 5.3.17-112.5.1
  • php5 SLE Software Development Kit 12 SP3, SLE Software Development Kit 12 SP2, SLE Module for Web and Scripting 12 5.5.14-109.5.1
  • php7 SLE Software Development Kit 12 SP3, SLE Software Development Kit 12 SP2, SLE Module for Web and Scripting 12 7.0.7-50.9.2
  • php53 SLES for SAP 11 SP4, SLES 11 SP4, SLE Software Development Kit 11 SP4 5.3.17-74.1
  • php5 SLE Software Development Kit 12 SP1, SLE Module for Web and Scripting 12 5.5.14-68.1
  • php5 SLES 11 SP2-LTSS 5.2.14-0.7.30.89.1

suse advisories SUSE-SU-2017:2522-1SUSE-SU-2017:2317-1SUSE-SU-2017:2303-1SUSE-SU-2016:2080-1SUSE-SU-2016:2013-1SUSE-SU-2016:1842-1

  • gd openSUSE Tumbleweed 2.2.3-2.1

opensuse advisories openSUSE-SU-2024:10062-1

  • gd Alpine 3.3, Alpine 3.2 2.2.1-r2
  • gd Alpine 3.4 2.2.3-r0

alpine advisories ALPINE-CVE-2016-5766

Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2016-5766 updated cvss 5.6

gd: Integer overflow in _gd2GetHeader() resulting in heap overflow

  • Red Hat Enterprise Linux 5 gd, php, php53 Red Hat Enterprise Linux 6 gd, php, php-gd, php-cli, php-dba, php-fpm, +22 more
    affected: no fix planned “Will not fix”
  • Red Hat OpenShift Enterprise 2 gd
    affected: no fix available
  • Red Hat Software Collections php54-php, php55-php, php54-php-gd, php55-php-gd, php54-php-cli, php54-php-dba, +44 more
    affected: no fix planned “Will not fix”
  • Red Hat Enterprise Linux Client (v. 7) gd 2.0.35-27.el7_9 Red Hat Enterprise Linux Client Optional (v. 7) php 5.4.16-42.el7, php-gd 5.4.16-42.el7, php-cli 5.4.16-42.el7, php-dba 5.4.16-42.el7, php-fpm 5.4.16-42.el7, php-pdo 5.4.16-42.el7, +19 more Red Hat Enterprise Linux ComputeNode Optional (v. 7) php 5.4.16-42.el7, php-gd 5.4.16-42.el7, php-cli 5.4.16-42.el7, php-dba 5.4.16-42.el7, php-fpm 5.4.16-42.el7, php-pdo 5.4.16-42.el7, +19 more Red Hat Enterprise Linux Server (v. 7) php 5.4.16-42.el7, gd 2.0.35-27.el7_9, php-gd 5.4.16-42.el7, php-cli 5.4.16-42.el7, php-pdo 5.4.16-42.el7, php-xml 5.4.16-42.el7, +9 more Red Hat Enterprise Linux Server Optional (v. 7) php-dba 5.4.16-42.el7, php-fpm 5.4.16-42.el7, php-intl 5.4.16-42.el7, php-snmp 5.4.16-42.el7, gd-progs 2.0.35-27.el7_9, php-bcmath 5.4.16-42.el7, +5 more Red Hat Enterprise Linux Workstation (v. 7) php 5.4.16-42.el7, gd 2.0.35-27.el7_9, php-gd 5.4.16-42.el7, php-cli 5.4.16-42.el7, php-pdo 5.4.16-42.el7, php-xml 5.4.16-42.el7, +9 more
    +1 more products
    Red Hat Enterprise Linux Workstation Optional (v. 7) php-dba 5.4.16-42.el7, php-fpm 5.4.16-42.el7, php-intl 5.4.16-42.el7, php-snmp 5.4.16-42.el7, gd-progs 2.0.35-27.el7_9, php-bcmath 5.4.16-42.el7, +5 more
    fixed: vendor fix RHSA-2020:5443
  • Red Hat Software Collections for Red Hat Enterprise Linux Server (v. 6) rh-php56 2.3-1.el6, rh-php56-php 5.6.25-1.el6, rh-php56-runtime 2.3-1.el6, rh-php56-scldevel 2.3-1.el6, rh-php56-php-gd 5.6.25-1.el6, rh-php56-php-cli 5.6.25-1.el6, +26 more Red Hat Software Collections for Red Hat Enterprise Linux Server (v. 7) rh-php56 2.3-1.el7, rh-php56-php 5.6.25-1.el7, rh-php56-runtime 2.3-1.el7, rh-php56-scldevel 2.3-1.el7, rh-php56-php-gd 5.6.25-1.el7, rh-php56-php-cli 5.6.25-1.el7, +24 more Red Hat Software Collections for Red Hat Enterprise Linux Server EUS (v. 6.7) rh-php56 2.3-1.el6, rh-php56-php 5.6.25-1.el6, rh-php56-runtime 2.3-1.el6, rh-php56-scldevel 2.3-1.el6, rh-php56-php-gd 5.6.25-1.el6, rh-php56-php-cli 5.6.25-1.el6, +26 more Red Hat Software Collections for Red Hat Enterprise Linux Server EUS (v. 7.2) rh-php56 2.3-1.el7, rh-php56-php 5.6.25-1.el7, rh-php56-runtime 2.3-1.el7, rh-php56-scldevel 2.3-1.el7, rh-php56-php-gd 5.6.25-1.el7, rh-php56-php-cli 5.6.25-1.el7, +24 more Red Hat Software Collections for Red Hat Enterprise Linux Server EUS (v. 7.3) rh-php56 2.3-1.el7, rh-php56-php 5.6.25-1.el7, rh-php56-runtime 2.3-1.el7, rh-php56-scldevel 2.3-1.el7, rh-php56-php-gd 5.6.25-1.el7, rh-php56-php-cli 5.6.25-1.el7, +24 more Red Hat Software Collections for Red Hat Enterprise Linux Workstation (v. 6) rh-php56 2.3-1.el6, rh-php56-php 5.6.25-1.el6, rh-php56-runtime 2.3-1.el6, rh-php56-scldevel 2.3-1.el6, rh-php56-php-gd 5.6.25-1.el6, rh-php56-php-cli 5.6.25-1.el6, +26 more
    +1 more products
    Red Hat Software Collections for Red Hat Enterprise Linux Workstation (v. 7) rh-php56 2.3-1.el7, rh-php56-php 5.6.25-1.el7, rh-php56-runtime 2.3-1.el7, rh-php56-scldevel 2.3-1.el7, rh-php56-php-gd 5.6.25-1.el7, rh-php56-php-cli 5.6.25-1.el7, +24 more
    fixed: vendor fix RHSA-2016:2750
  • Red Hat Enterprise Linux 8 gd
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

Exploit prediction

7.50% chance of exploitation in the next 30 days, higher than 94% of all scored CVEs (FIRST EPSS, 2026-11-08).

Exploits and checks

  • github.com http://github.com/php/php-src/commit/7722455726bec8c53458a32851d2a87982cf0eac?w=1 referenced PoC, tagged "exploit" by a source, unverified
  • bugs.php.net https://bugs.php.net/bug.php?id=72339 referenced PoC, tagged "exploit" by a source, unverified

CVSS scores

assigned by version score vector
NVD 3.0 8.8 CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NVD 2.0 6.8 AV:N/AC:M/Au:N/C:P/I:P/A:P

Classification

Weakness
  • CWE-190 Integer Overflow or Wraparound

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.