CVE-2022-27938
Medium · 5.5CVSS
5.5
EPSS
0.6%
Published
Mar 26, 2022
CISA due date
—
Cloudanix analysis
A flaw in image handling code can cause programs to stop working when they try to open certain picture files.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Improper Input Validation
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
A reachable assertion failure in stbi__create_png_image_raw within stb_image.h causes abnormal termination when parsing a malformed PNG image.
Why it matters to the business
Applications handling images may crash on crafted PNG files, disrupting workflows and enabling local denial of service. The issue has been public for over four years with available exploits.
How an attack unfolds
An attacker creates a PNG image that violates internal assumptions in the PNG decoder. The victim opens or processes the file locally in an affected application such as ImageMagick, triggering the assertion and crashing the process.
How to fix it
Upgrade ImageMagick to the commit e50f19fd73c792ebe912df8ab83aa51a243a3da7 or newer that resolves the assertion in the PNG decoder.
How to confirm the fix worked
Confirm the installed ImageMagick binary or library was built after the referenced commit; attempt to load a known triggering PNG without causing a crash.
Typical attack path
- Generate a PNG file that reaches the failing assertion in stbi__create_png_image_raw
- Deliver the file to the target via local filesystem, email, or web download
- Victim opens or converts the image using the vulnerable library
- Application terminates due to the triggered assertion
How to detect it
Review application crash logs and core dumps for assertion failures or abnormal exits while processing PNG images; correlate with file access timestamps on suspicious PNG files.
- stbi__create_png_image_raw
- assertion failed
- stb_image.h
What your security team should do
- Update ImageMagick installations to the fixed commit immediately
- Block untrusted image files from automated processing pipelines until patched
- Review and remove any outdated copies of stb_image.h or libsixel from build environments
The record
stb_image.h (aka the stb image loader) 2.19, as used in libsixel and other products, has a reachable assertion in stbi__create_png_image_raw.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:10 | libstb | 0 | No fix |
| 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-2022-28042 stb_image.h v2.27 was discovered to contain an heap-based use-after-free via the function… Also affects libstb
- CVE-2022-28041 stb_image.h v2.27 was discovered to contain an integer overflow via the function… Also affects libstb
- CVE-2021-42715 An issue was discovered in stb stb_image.h 1.33 through 2.27. Also affects libstb
- 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