CVE-2023-45664
JSON

7.3high

Double-free in stbi__load_gif_main_outofmem in stb_image

Severity
7.3high CVSS:3.1 by GitHub_M
Exploit likelihood
0.93% (higher than 61% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M

Description

stb_image is a single file MIT licensed library for processing images. A crafted image file can trigger `stbi__load_gif_main_outofmem` attempt to double-free the out variable. This happens in `stbi__load_gif_main` because when the `layers * stride` value is zero the behavior is implementation defined, but common that realloc frees the old memory and returns null pointer. Since it attempts to double-free the memory a few lines below the first “free”, the issue can be potentially exploited only in a multi-threaded environment. In the worst case this may lead to code execution.

Affected

Product or packageVersionsReported by
nothings stb<= 2.28CVE List
nothings stb_imageup to 2.28CVE List
nothings stb_image.h2.28NVD

All scores

GitHub_M7.3high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-415

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.

What each source says

CVE List

stb_image is a single file MIT licensed library for processing images. A crafted image file can trigger `stbi__load_gif_main_outofmem` attempt to double-free the out variable. This happens in `stbi__load_gif_main` because when the `layers * stride` value is zero the behavior is implementation defined, but common that realloc frees the old memory and returns null pointer. Since it attempts to double-free the memory a few lines below the first “free”, the issue can be potentially exploited only in a multi-threaded environment. In the worst case this may lead to code execution.

NVD (es)

stb_image es una librería con licencia MIT de un solo archivo para procesar imágenes. Un archivo de imagen manipulado puede provocar que `stbi__load_gif_main_outofmem` intente liberar dos veces la variable out. Esto sucede en `stbi__load_gif_main` porque cuando el valor de `layers * stride` es cero, el comportamiento está definido por la implementación, pero es común que la realloc libere la memoria antigua y devuelva un puntero nulo. Dado que intenta liberar dos veces la memoria unas pocas líneas debajo de la primera "free", el problema sólo puede explotarse en un entorno de subprocesos múltiples. En el peor de los casos, esto puede provocar la ejecución del código.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-45664 changed 2025-02-13CVE Terms of Use
NVDCVE-2023-45664 changed 2026-06-17Public domain