Stb Image.hApplication · Nothings

CVE-2023-45666

CRITICAL · 9.8 CVSS v3.1 Published 2023-10-21
Mitigation only
No fix yet — a mitigation exists. There is no fixed release. A documented workaround reduces exposure in the meantime.
See remediation →
100/100
Remediation priority · Urgent
Remotely reachable No privileges Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
stb_image is a single file MIT licensed library for processing images. It may look like `stbi__load_gif_main` doesn’t give guarantees about the content of output value `*delays` upon failure. Although it sets `*delays` to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to `stbi__load_gif_main_outofmem` only frees possibly allocated memory in `*delays` without resetting it to zero. Thus it would be fair to say the caller of `stbi__load_gif_main` is responsible to free the allocated memory in `*delays` only if `stbi__load_gif_main` returns a non null value. However at the same time the function may return null value, but fail to free the memory in `*delays` if internally `stbi__convert_format` is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free `delays` only when `stbi__load_gif_main` didn’t fail or to a double-free if the `delays` is always freed

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

stb_image's stbi__load_gif_main has a memory management flaw where *delays is not reset to zero after being freed in the outofmem path, and memory is not properly freed when stbi__convert_format fails internally. This can lead to memory leaks or double-free conditions depending on caller behavior, with use-after-free possible if the caller attempts to use the freed pointer.

MitigationEnsure *delays is set to NULL after freeing in all error paths, particularly in stbi__load_gif_main_outofmem and when stbi__convert_format fails. Update caller guidance to always check and free delays regardless of return value.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
Stb Image.hApplication
Affected:= 2.28

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Locate stb_image.h in your environment
    Search for files named stb_image.h, stb_image.c, or similar in your project dependencies, libraries, or included header directories.
    Affected if The file exists and is used by your application
  2. Identify the installed version of stb_image
    Open the stb_image.h file and search for a version definition such as STB_IMAGE_VERSION, STB_IMAGE_VERSION_STRING, or a comment/note indicating the version number (typically near the top of the file).
    Affected if The version is exactly 2.28 (version 2.28)
  3. Determine if GIF loading is used
    Search your codebase for calls to GIF-related stb_image functions such as stbi_load_gif, stbi_image_load, or similar functions that load GIF images.
    Affected if Your code loads GIF images using stb_image functions
  4. Inspect the stbi__load_gif_main function for the memory flaw
    Open stb_image.h and locate the function stbi__load_gif_main. Within this function, look for the 'outofmem' label/path where delays is freed, and check if *delays is set to NULL after freeing. Also check if stbi__convert_format failure paths properly free delays before returning.
    Affected if The code shows *delays is NOT set to NULL after being freed in the outofmem path, OR memory is not freed when stbi__convert_format fails internally

Your environment is affected if you are using stb_image.h version 2.28 and your code loads GIF images using stb_image functions, with the vulnerable code paths in stbi__load_gif_main being reached.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

From vendor data
Mitigation available No clean upgrade yet — mitigate in the meantime
Mitigation

Ensure *delays is set to NULL after freeing in all error paths, particularly in stbi__load_gif_main_outofmem and when stbi__convert_format fails. Update caller guidance to always check and free delays regardless of return value.

Fix this in Stb Image.h Scoped from the published advisory
  • Consultation1.0 h
  • Implementation2.0 h
  • Testing2.0 h
  • Review / QA1.0 h
6.0 hours of engineering $1,040
Get help mitigating

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $1,664.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2023-45666 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2023-45666 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data