libgd CVE Vulnerabilities & Metrics

Focus on libgd vulnerabilities and metrics.

Last updated: 08 Mar 2025, 23:25 UTC

About libgd Security Exposure

This page consolidates all known Common Vulnerabilities and Exposures (CVEs) associated with libgd. We track both calendar-based metrics (using fixed periods) and rolling metrics (using gliding windows) to give you a comprehensive view of security trends and risk evolution. Use these insights to assess risk and plan your patching strategy.

For a broader perspective on cybersecurity threats, explore the comprehensive list of CVEs by vendor and product. Stay updated on critical vulnerabilities affecting major software and hardware providers.

Global CVE Overview

Total libgd CVEs: 33
Earliest CVE date: 18 May 2007, 18:30 UTC
Latest CVE date: 08 Sep 2021, 21:15 UTC

Latest CVE reference: CVE-2021-40812

Rolling Stats

30-day Count (Rolling): 0
365-day Count (Rolling): 0

Calendar-based Variation

Calendar-based Variation compares a fixed calendar period (e.g., this month versus the same month last year), while Rolling Growth Rate uses a continuous window (e.g., last 30 days versus the previous 30 days) to capture trends independent of calendar boundaries.

Variations & Growth

Month Variation (Calendar): 0%
Year Variation (Calendar): 0%

Month Growth Rate (30-day Rolling): 0.0%
Year Growth Rate (365-day Rolling): 0.0%

Monthly CVE Trends (current vs previous Year)

Annual CVE Trends (Last 20 Years)

Critical libgd CVEs (CVSS ≥ 9) Over 20 Years

CVSS Stats

Average CVSS: 5.6

Max CVSS: 9.3

Critical CVEs (≥9): 1

CVSS Range vs. Count

Range Count
0.0-3.9 1
4.0-6.9 29
7.0-8.9 7
9.0-10.0 1

CVSS Distribution Chart

Top 5 Highest CVSS libgd CVEs

These are the five CVEs with the highest CVSS scores for libgd, sorted by severity first and recency.

All CVEs for libgd

CVE-2021-40812 libgd vulnerability CVSS: 4.3 08 Sep 2021, 21:15 UTC

The GD Graphics Library (aka LibGD) through 2.3.2 has an out-of-bounds read because of the lack of certain gdGetBuf and gdPutBuf return value checks.

CVE-2021-40145 libgd vulnerability CVSS: 5.0 26 Aug 2021, 01:15 UTC

gdImageGd2Ptr in gd_gd2.c in the GD Graphics Library (aka LibGD) through 2.3.2 has a double free. NOTE: the vendor's position is "The GD2 image format is a proprietary image format of libgd. It has to be regarded as being obsolete, and should only be used for development and testing purposes.

CVE-2021-38115 libgd vulnerability CVSS: 4.3 04 Aug 2021, 21:15 UTC

read_header_tga in gd_tga.c in the GD Graphics Library (aka LibGD) through 2.3.2 allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted TGA file.

CVE-2017-6363 libgd vulnerability CVSS: 5.8 27 Feb 2020, 05:15 UTC

In the GD Graphics Library (aka LibGD) through 2.2.5, there is a heap-based buffer over-read in tiffWriter in gd_tiff.c. NOTE: the vendor says "In my opinion this issue should not have a CVE, since the GD and GD2 formats are documented to be 'obsolete, and should only be used for development and testing purposes.'

CVE-2018-14553 libgd vulnerability CVSS: 4.3 11 Feb 2020, 13:15 UTC

gdImageClone in gd.c in libgd 2.1.0-rc2 through 2.2.5 has a NULL pointer dereference allowing attackers to crash an application via a specific function call sequence. Only affects PHP when linked with an external libgd (not bundled).

CVE-2019-11038 libgd vulnerability CVSS: 5.0 19 Jun 2019, 00:15 UTC

When using the gdImageCreateFromXbm() function in the GD Graphics Library (aka LibGD) 2.2.5, as used in the PHP GD extension in PHP versions 7.1.x below 7.1.30, 7.2.x below 7.2.19 and 7.3.x below 7.3.6, it is possible to supply data that will cause the function to use the value of uninitialized variable. This may lead to disclosing contents of the stack that has been left there by previous code.

CVE-2019-6978 libgd vulnerability CVSS: 7.5 28 Jan 2019, 08:29 UTC

The GD Graphics Library (aka LibGD) 2.2.5 has a double free in the gdImage*Ptr() functions in gd_gif_out.c, gd_jpeg.c, and gd_wbmp.c. NOTE: PHP is unaffected.

CVE-2019-6977 libgd vulnerability CVSS: 6.8 27 Jan 2019, 02:29 UTC

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.

CVE-2018-1000222 libgd vulnerability CVSS: 6.8 20 Aug 2018, 20:29 UTC

Libgd version 2.2.5 contains a Double Free Vulnerability vulnerability in gdImageBmpPtr Function that can result in Remote Code Execution . This attack appear to be exploitable via Specially Crafted Jpeg Image can trigger double free. This vulnerability appears to have been fixed in after commit ac16bdf2d41724b5a65255d4c28fb0ec46bc42f5.

CVE-2017-6362 libgd vulnerability CVSS: 5.0 07 Sep 2017, 13:29 UTC

Double free vulnerability in the gdImagePngPtr function in libgd2 before 2.2.5 allows remote attackers to cause a denial of service via vectors related to a palette with no colors.

CVE-2016-10168 libgd vulnerability CVSS: 6.8 15 Mar 2017, 15:59 UTC

Integer overflow in gd_io.c in the GD Graphics Library (aka libgd) before 2.2.4 allows remote attackers to have unspecified impact via vectors involving the number of horizontal and vertical chunks in an image.

CVE-2016-10167 libgd vulnerability CVSS: 4.3 15 Mar 2017, 15:59 UTC

The gdImageCreateFromGd2Ctx function in gd_gd2.c in the GD Graphics Library (aka libgd) before 2.2.4 allows remote attackers to cause a denial of service (application crash) via a crafted image file.

CVE-2016-10166 libgd vulnerability CVSS: 7.5 15 Mar 2017, 15:59 UTC

Integer underflow in the _gdContributionsAlloc function in gd_interpolation.c in the GD Graphics Library (aka libgd) before 2.2.4 allows remote attackers to have unspecified impact via vectors related to decrementing the u variable.

CVE-2016-6906 libgd vulnerability CVSS: 4.3 15 Mar 2017, 14:59 UTC

The read_image_tga function in gd_tga.c in the GD Graphics Library (aka libgd) before 2.2.4 allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted TGA file, related to the decompression buffer.

CVE-2016-9317 libgd vulnerability CVSS: 7.1 26 Jan 2017, 15:59 UTC

The gdImageCreate function in the GD Graphics Library (aka libgd) before 2.2.4 allows remote attackers to cause a denial of service (system hang) via an oversized image.

CVE-2016-6912 libgd vulnerability CVSS: 7.5 26 Jan 2017, 15:59 UTC

Double free vulnerability in the gdImageWebPtr function in the GD Graphics Library (aka libgd) before 2.2.4 allows remote attackers to have unspecified impact via large width and height values.

CVE-2016-6911 libgd vulnerability CVSS: 4.3 26 Jan 2017, 15:59 UTC

The dynamicGetbuf function in the GD Graphics Library (aka libgd) before 2.2.4 allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted TIFF image.

CVE-2016-9933 libgd vulnerability CVSS: 5.0 04 Jan 2017, 20:59 UTC

Stack consumption vulnerability in the gdImageFillToBorder function in gd.c in the GD Graphics Library (aka libgd) before 2.2.2, as used in PHP before 5.6.28 and 7.x before 7.0.13, allows remote attackers to cause a denial of service (segmentation violation) via a crafted imagefilltoborder call that triggers use of a negative color value.

CVE-2016-8670 libgd vulnerability CVSS: 7.5 04 Jan 2017, 20:59 UTC

Integer signedness error in the dynamicGetbuf function in gd_io_dp.c in the GD Graphics Library (aka libgd) through 2.2.3, as used in PHP before 5.6.28 and 7.x before 7.0.13, allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a crafted imagecreatefromstring call.

CVE-2016-6905 libgd vulnerability CVSS: 4.3 03 Oct 2016, 21:59 UTC

The read_image_tga function in gd_tga.c in the GD Graphics Library (aka libgd) before 2.2.3 allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted TGA image.

CVE-2016-7568 libgd vulnerability CVSS: 7.5 28 Sep 2016, 20:59 UTC

Integer overflow in the gdImageWebpCtx function in gd_webp.c in the GD Graphics Library (aka libgd) through 2.2.3, as used in PHP through 7.0.11, allows remote attackers to cause a denial of service (heap-based buffer overflow) or possibly have unspecified other impact via crafted imagewebp and imagedestroy calls.

CVE-2016-6214 libgd vulnerability CVSS: 4.3 12 Aug 2016, 15:59 UTC

gd_tga.c in the GD Graphics Library (aka libgd) before 2.2.3 allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted TGA file.

CVE-2016-6207 libgd vulnerability CVSS: 4.3 12 Aug 2016, 15:59 UTC

Integer overflow in the _gdContributionsAlloc function in gd_interpolation.c in GD Graphics Library (aka libgd) before 2.2.3 allows remote attackers to cause a denial of service (out-of-bounds memory write or memory consumption) via unspecified vectors.

CVE-2016-6161 libgd vulnerability CVSS: 4.3 12 Aug 2016, 15:59 UTC

The output function in gd_gif_out.c in the GD Graphics Library (aka libgd) allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted image.

CVE-2016-6132 libgd vulnerability CVSS: 4.3 12 Aug 2016, 15:59 UTC

The gdImageCreateFromTgaCtx function in the GD Graphics Library (aka libgd) before 2.2.3 allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted TGA file.

CVE-2016-6128 libgd vulnerability CVSS: 5.0 07 Aug 2016, 10:59 UTC

The gdImageCropThreshold function in gd_crop.c in the GD Graphics Library (aka libgd) before 2.2.3, as used in PHP before 7.0.9, allows remote attackers to cause a denial of service (application crash) via an invalid color index.

CVE-2016-5767 libgd vulnerability CVSS: 6.8 07 Aug 2016, 10:59 UTC

Integer overflow in the gdImageCreate function in gd.c in the GD Graphics Library (aka libgd) before 2.0.34RC1, 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 a crafted image dimensions.

CVE-2016-5766 libgd vulnerability CVSS: 6.8 07 Aug 2016, 10:59 UTC

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.

CVE-2016-5116 libgd vulnerability CVSS: 6.4 07 Aug 2016, 10:59 UTC

gd_xbm.c in the GD Graphics Library (aka libgd) before 2.2.0, as used in certain custom PHP 5.5.x configurations, allows context-dependent attackers to obtain sensitive information from process memory or cause a denial of service (stack-based buffer under-read and application crash) via a long name.

CVE-2013-7456 libgd vulnerability CVSS: 6.8 07 Aug 2016, 10:59 UTC

gd_interpolation.c in the GD Graphics Library (aka libgd) before 2.1.1, as used in PHP before 5.5.36, 5.6.x before 5.6.22, and 7.x before 7.0.7, allows remote attackers to cause a denial of service (out-of-bounds read) or possibly have unspecified other impact via a crafted image that is mishandled by the imagescale function.

CVE-2015-8877 libgd vulnerability CVSS: 5.0 22 May 2016, 01:59 UTC

The gdImageScaleTwoPass function in gd_interpolation.c in the GD Graphics Library (aka libgd) before 2.2.0, as used in PHP before 5.6.12, uses inconsistent allocate and free approaches, which allows remote attackers to cause a denial of service (memory consumption) via a crafted call, as demonstrated by a call to the PHP imagescale function.

CVE-2016-3074 libgd vulnerability CVSS: 7.5 26 Apr 2016, 14:59 UTC

Integer signedness error in GD Graphics Library 2.1.1 (aka libgd or libgd2) allows remote attackers to cause a denial of service (crash) or potentially execute arbitrary code via crafted compressed gd2 data, which triggers a heap-based buffer overflow.

CVE-2014-9709 libgd vulnerability CVSS: 5.0 30 Mar 2015, 10:59 UTC

The GetCode_ function in gd_gif_in.c in GD 2.1.1 and earlier, as used in PHP before 5.5.21 and 5.6.x before 5.6.5, allows remote attackers to cause a denial of service (buffer over-read and application crash) via a crafted GIF image that is improperly handled by the gdImageCreateFromGif function.

CVE-2009-3546 libgd vulnerability CVSS: 9.3 19 Oct 2009, 20:00 UTC

The _gdGetColors function in gd_gd.c in PHP 5.2.11 and 5.3.x before 5.3.1, and the GD Graphics Library 2.x, does not properly verify a certain colorsTotal structure member, which might allow remote attackers to conduct buffer overflow or buffer over-read attacks via a crafted GD file, a different vulnerability than CVE-2009-3293. NOTE: some of these details are obtained from third party information.

CVE-2007-3477 libgd vulnerability CVSS: 5.0 28 Jun 2007, 18:30 UTC

The (a) imagearc and (b) imagefilledarc functions in GD Graphics Library (libgd) before 2.0.35 allow attackers to cause a denial of service (CPU consumption) via a large (1) start or (2) end angle degree value.

CVE-2007-3472 libgd vulnerability CVSS: 4.3 28 Jun 2007, 18:30 UTC

Integer overflow in gdImageCreateTrueColor function in the GD Graphics Library (libgd) before 2.0.35 allows user-assisted remote attackers to have unspecified attack vectors and impact.

CVE-2007-3474 libgd vulnerability CVSS: 2.6 28 Jun 2007, 18:30 UTC

Multiple unspecified vulnerabilities in the GIF reader in the GD Graphics Library (libgd) before 2.0.35 have unspecified impact and user-assisted remote attack vectors.

CVE-2007-2756 libgd vulnerability CVSS: 4.3 18 May 2007, 18:30 UTC

The gdPngReadData function in libgd 2.0.34 allows user-assisted attackers to cause a denial of service (CPU consumption) via a crafted PNG image with truncated data, which causes an infinite loop in the png_read_info function in libpng.