Skip to content
Fencer Vulns
high 7.5

CVE-2021-40145 json

gdImageGd2Ptr in gd_gd2.c in the GD Graphics Library (aka LibGD) through 2.3.2 has a double free.

published 2021-08-26 5 y ago modified 2026-06-17 4 mo ago also EUVD-2021-27331

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

Summary

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.

Patch / fix

  • libgd2 Debian 14, Debian 13, Debian 12 2.3.3-1

debian advisories DEBIAN-CVE-2021-40145

  • libgd2 Ubuntu 18.04 LTS 2.2.5-4ubuntu0.5
  • libgd2 Ubuntu 20.04 LTS 2.2.5-5.2ubuntu2.1
  • libgd2 Ubuntu 22.04 LTS 2.3.0-2ubuntu1
  • libgd2 Ubuntu Pro 14.04 LTS 2.1.0-3ubuntu0.11+esm2
  • libgd2 Ubuntu Pro 16.04 LTS 2.1.1-4ubuntu0.16.04.12+esm1

ubuntu advisories UBUNTU-CVE-2021-40145

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

  • gd Alpine 3.11 2.2.5-r4
  • gd Alpine 3.24, Alpine 3.23, Alpine 3.22 +10 more 2.3.0-r1

alpine advisories ALPINE-CVE-2021-40145

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

  • gd CBL-Mariner 2.0 2.3.0-5

azure linux advisories AZL-6432

Azure Linux vulnerability data, Copyright (c) Microsoft Corporation, from https://github.com/microsoft/AzureLinuxVulnerabilityData via OSV, under the MIT licence; changed: normalised to fixed package versions per release. MIT

  • gd Arch Linux 2.3.3-1

arch linux advisories AVG-2258

Exploit prediction

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

Exploits and checks

  • github.com https://github.com/libgd/libgd/issues/700 referenced PoC, tagged "exploit" by a source, unverified

CVSS scores

assigned by version score vector
NVD 3.1 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD 2.0 5.0 AV:N/AC:L/Au:N/C:N/I:N/A:P

Classification

Weakness

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.