CVE-2023-45662 Multi-byte read heap buffer overflow in stbi__vertical_flip in stb_image

Medium 6.5 Published Updated

A crafted image triggers a heap buffer overflow in stb_image when vertical flipping is enabled with mismatched component counts, potentially causing crashes or data leaks.

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

What is CVE-2023-45662?

CVE-2023-45662 is a medium-severity memory corruption vulnerability in nothings stb, published on 20 Oct 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

stb_image is a single file MIT licensed library for processing images. When `stbi_set_flip_vertically_on_load` is set to `TRUE` and `req_comp` is set to a number that doesn’t match the real number of components per pixel, the library attempts to flip the image vertically. A crafted image file can trigger `memcpy` out-of-bounds read because `bytes_per_pixel` used to calculate `bytes_per_row` doesn’t match the real image array dimensions.

Weakness: CWE-125

Which versions are affected by CVE-2023-45662?

It affects 1 product.

Products include Nothings Stb Image.h.

How do I fix CVE-2023-45662?

Apply the vendor's patch.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2023-45662 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-45662 exists.

Sources

Also known as DEBIAN-CVE-2023-45662, UBUNTU-CVE-2023-45662.

Is CVE-2023-45662 in your software?

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

Check your SBOMs for free