CVE-2021-40145: gdImageGd2Ptr in gd_gd2.c in the GD Graphics Library (aka LibGD) through 2.3.2 has a double free
CVE-2021-40145 is a high-severity flaw (CVSS 7.5) affecting libgd. Below: why it ranks where it does, which versions are affected, what to do, and the exact commands.
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.
Why this priority
- High severity
- Public exploit reference
- Remotely exploitable, no login, no user action
A fixed release or distro patch exists.
Risk facts
| CVSS score | 7.5 (High) |
| Attack vector | Network (remote) |
| Attack complexity | Low |
| Privileges needed | None |
| User interaction | None |
| EPSS exploit chance | 2.1% (top 18%) |
| CISA exploited list | No |
| Weakness | CWE-415 |
| Published | 2021-08-26 |
| Last modified | 2026-06-17 |
Last updated 2026-06-17 · Sources: CVE Program, NVD, CISA KEV, EPSS and vendor advisories · How we score
Am I affected?
Timeline
- Published CVE record published
- Updated Record last modified
Scores and fixes here are computed automatically from those and other public sources. Confirm with the vendor advisory before changing production systems.
Quick answers
How do I fix CVE-2021-40145?
libgd: upgrade to newer than 2.3.2. Exact commands for each OS are on this page.
Is CVE-2021-40145 being exploited?
CVE-2021-40145 is not on the CISA Known Exploited Vulnerabilities list at the time of the last update. Check again, as this can change.
What does CVE-2021-40145 affect?
CVE-2021-40145 affects libgd. Severity is high (CVSS 7.5). 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 shou
How urgent is CVE-2021-40145?
Priority 57/100. High severity; Public exploit reference; Remotely exploitable, no login, no user action
Related CVEs
- CVE-2021-40812 MEDIUM 6.5 UPGRADE The GD Graphics Library (aka LibGD) through 2.3.2 has an out-of-bounds read because of the lack of certain gdG
- CVE-2021-38115 MEDIUM 6.5 UPGRADE read_header_tga in gd_tga.c in the GD Graphics Library (aka LibGD) through 2.3.2 allows remote attackers to ca