Double Free in libgd - CVE-2021-40145

 

Double Free in libgd - CVE-2021-40145

Published: April 6, 2023


Vulnerability identifier: #VU74503
CSH Severity: High
CVSS v4: 9.3 [CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N]
CVE-ID: CVE-2021-40145
CWE-ID: CWE-415
Exploitation vector: Remote access
Exploit availability: No public exploit available

Vulnerability details

The vulnerability allows a remote attacker to execute arbitrary code on the target system.

The vulnerability exists due to a boundary error within the gdImageGd2Ptr() function in gd_gd2.c. A remote attacker can pass specially crafted data to the application, trigger double free error and execute arbitrary code on the target system.

Successful exploitation of this vulnerability may result in complete compromise of vulnerable system.


Affected software

libgd
Amazon Linux AMI
Ubuntu
libgd3 (Ubuntu package)
gd

How to mitigate CVE-2021-40145

Install updates from vendor's website.

libgd - update to 2.3.3
libgd3 (Ubuntu package) - addressed in versions Ubuntu Pro, 2.2.5-4ubuntu0.5, 2.2.5-5.2ubuntu2.1, 2.3.0-2ubuntu0.1
gd - update to 2.0.35-11.11

External References

Related Security Bulletins