CVE-2021-40145 Use after free in n/a

High 7.5 Published Updated

A double free vulnerability in the GD Graphics Library allows attackers to cause denial of service or potentially execute arbitrary code via crafted GD2 images.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-40145?

CVE-2021-40145 is a high-severity use after free vulnerability in n/a, published on 26 Aug 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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.

Weakness: CWE-415

Which versions are affected by CVE-2021-40145?

It affects 1 product.

Products include Libgd Libgd.

How do I fix CVE-2021-40145?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2021-40145 being exploited?

There is no known exploitation of CVE-2021-40145 in the wild and no public exploit code.

Sources

Also known as ALPINE-CVE-2021-40145, AZL-6432, CLSA-2022-1644931813, CLSA-2022-1646915745, CLSA-2026-1776445382, CLSA-2026-1777541021 and 6 more.

Is CVE-2021-40145 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free