CVE-2022-28042
High · 8.8CVSS
8.8
EPSS
1.6%
Published
Apr 15, 2022
CISA due date
—
Cloudanix analysis
A flaw in how some apps handle image files could let attackers crash those apps or take control of devices by tricking users into opening a bad picture.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Use After Free
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Heap-based use-after-free in the stbi__jpeg_huff_decode function of stb_image.h allows memory corruption during JPEG processing.
Why it matters to the business
Applications using the affected library face risk of crashes or remote code execution when processing untrusted images, potentially disrupting mobile app services and requiring urgent dependency updates.
How an attack unfolds
An attacker crafts a malicious JPEG image that triggers the use-after-free condition during Huffman decoding; when the image is loaded by an affected application the corrupted memory state can be leveraged for arbitrary code execution.
How to fix it
Upgrade software-mansion/react-native-reanimated to commit 1b61196c1a5e2f05da533b6035c6663d0129bbc5 or later; rebuild and redeploy all dependent mobile applications.
How to confirm the fix worked
Verify the react-native-reanimated dependency resolves to commit 1b61196c1a5e2f05da533b6035c6663d0129bbc5 and test image decoding with known-malformed JPEG samples for absence of crashes or memory errors.
Typical attack path
- Attacker prepares a specially crafted JPEG file exploiting the Huffman decode path
- Victim application loads the image via the vulnerable stb_image code path
- Use-after-free occurs leading to memory corruption
- Attacker chains the corruption to achieve code execution or denial of service
How to detect it
Review application crash logs and memory sanitizer reports for patterns involving JPEG Huffman decode failures; inspect network or file logs for unexpected JPEG uploads immediately preceding crashes.
What your security team should do
- Immediately update react-native-reanimated to the fixed commit across all projects
- Scan dependency trees for any other packages shipping the vulnerable stb_image version
- Add automated dependency update checks and image-fuzzing tests to the CI pipeline
- Monitor for new exploit code or public PoCs given the ExploitAvailable maturity
The record
stb_image.h v2.27 was discovered to contain an heap-based use-after-free via the function stbi__jpeg_huff_decode.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:10 | libstb | 0 | 0.0~git20180212.15.e6afb9c-1+deb10u1 |
| Debian:11 | libstb | 0 | No fix |
| Debian:12 | libstb | 0 | No fix |
| Debian:13 | libstb | 0 | 0.0~git20230129.5736b15+ds-1 |
| 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-28041 stb_image.h v2.27 was discovered to contain an integer overflow via the function… Also affects libstb
- CVE-2022-27938 stb_image.h (aka the stb image loader) 2.19, as used in libsixel and other products, has… 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