CVE-2023-45667
High · 7.5CVSS
7.5
EPSS
1.3%
Published
Oct 21, 2023
CISA due date
—
Cloudanix analysis
A flaw in a popular image library can make programs crash when they try to handle certain picture files, potentially knocking services offline.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Null pointer dereference combined with use of an uninitialized variable in stbi__load_gif_main when GIF decoding fails and the caller requests vertical flipping, resulting in a crash inside stbi__vertical_flip_slices.
Why it matters to the business
Applications that process untrusted GIF images using the affected library can be forced to terminate unexpectedly, causing denial of service for image-handling services and workflows.
How an attack unfolds
An attacker supplies a specially crafted GIF image that triggers a failure path inside stbi__load_gif_main. When the calling code also sets the vertical-flip flag, the library passes a null buffer and an uninitialized length value to the flip routine, crashing the process.
How to fix it
Update the stb_image single-header library to a version that correctly initializes variables and checks for NULL before calling the flip routine; rebuild and redeploy all dependent applications.
How to confirm the fix worked
Recompile with the patched header, then feed the application both valid and malformed GIFs with the vertical-flip flag set and confirm no crash occurs and the library returns an error instead of dereferencing NULL.
Typical attack path
- Identify an application that uses the stb_image library to decode GIF files and supports the vertical-flip option.
- Craft a GIF that causes stbi__load_gif_main to fail and return NULL while leaving z uninitialized.
- Deliver the image through any input channel the application accepts (file upload, network request, etc.).
- Trigger the vertical-flip code path, causing the crash.
How to detect it
Monitor application logs and crash dumps for segmentation faults or access violations that occur immediately after GIF decoding attempts; correlate with image-processing code paths that set the vertical-flip flag.
What your security team should do
- Inventory all products and services that statically or dynamically link the stb_image library.
- Prioritize patching any internet-facing services that accept GIF uploads or process external images.
- Add runtime sandboxing or resource limits around image decoding to limit blast radius until patches are applied.
The record
stb_image is a single file MIT licensed library for processing images. If `stbi__load_gif_main` in `stbi_load_gif_from_memory` fails it returns a null pointer and may keep the `z` variable uninitialized. In case the caller also sets the flip vertically flag, it continues and calls `stbi__vertical_flip_slices` with the null pointer result value and the uninitialized `z` value. This may result in a program crash.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | libstb | 0 | No fix |
| Debian:12 | libstb | 0 | No fix |
| Debian:13 | libstb | 0 | No fix |
| Ubuntu:20.04:LTS | libstb | 0 | No fix |
| Ubuntu:22.04:LTS | libstb | 0 | No fix |
| Ubuntu:24.04:LTS | libstb | 0 | No fix |
| Ubuntu:24.10 | libstb | 0 | No fix |
| Ubuntu:25.04 | libstb | 0 | No fix |
| Ubuntu:25.10 | libstb | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | libstb | 0 | No fix |
Related vulnerabilities
- CVE-2023-47212 A heap-based buffer overflow vulnerability exists in the comment functionality of stb… Also affects libstb
- CVE-2023-43281 Double Free vulnerability in Nothings Stb Image.h v.2.28 allows a remote attacker to… Also affects libstb
- CVE-2023-45664 stb_image is a single file MIT licensed library for processing images. Also affects libstb
- CVE-2023-45676 stb_vorbis is a single file MIT licensed library for processing ogg vorbis files. Also affects libstb
- CVE-2023-45682 stb_vorbis is a single file MIT licensed library for processing ogg vorbis files. Also affects libstb
- CVE-2023-45679 stb_vorbis is a single file MIT licensed library for processing ogg vorbis files. Also affects libstb
- CVE-2023-45675 stb_vorbis is a single file MIT licensed library for processing ogg vorbis files. Also affects libstb
- CVE-2023-45666 stb_image is a single file MIT licensed library for processing images. Also affects libstb