
Crash-only proof-of-concept for CVE-2026-21096, a 32-bit integer overflow leading to heap overflow in Samsung's Quram JPEG decoder, with reversing notes and an adb harness.
While reversing the bundled Samsung image codec library I ran into a crash that turned out to be far too easy to reach. The JPEG decoder's iteration path computes the size of one of its internal buffers with plain 32-bit signed arithmetic and never checks the result. Feed it a JPEG that claims a width of 65535 pixels and the allocation wraps from roughly 4.29 GB down to a 256 KB chunk, while the two memsets that follow get their sizes from two more 32-bit products that wrap the other way. One lands on a harmless 64 KB, the other turns into a fill of roughly 2⁶⁴ bytes starting two gigabytes below the buffer. The process dies before the decoder gets anywhere near the actual image data.
This repository documents that bug and makes it independently reproducible. What I am sharing here is only a crash-only PoC, meaning the crash and not the exploit. Everything published here stops at a deterministic segmentation fault inside the vendor library. No heap grooming, no control-flow hijack, no code execution, no delivery chain. The crash alone is enough to prove that the bug is real and that the arithmetic behind it behaves exactly as described. Building anything further out of it is a different kind of work, and it is not included here. Every file needed to reproduce the crash is published alongside this README.
Samsung fixed the bug in the September 2026 Security Maintenance
Release (SVE-2026-3282, "corrects implementation"). Everything here was
verified on a Galaxy phone whose security patch level predates that
release. The crash is deterministic, ten out of ten runs, and the
faulting frames sit inside the genuine
/system/lib64/libimagecodec.quram.so.
This PoC demonstrates the following.
The repository deliberately does not contain the following.
The crash is the point. It is enough to prove that the affected allocation and write can become inconsistent, and that is all I am publishing.
CVE-2026-21096 is the public identifier for this bug. The Samsung advisory tracks it internally as SVE-2026-3282 in their monthly bulletin. The description Samsung Mobile filed with MITRE as the CNA reads as follows.
Heap-based buffer overflow in JPEG decoder of libimagecodec.quram.so prior to SMR Sep-2026 Release 1 allows remote attackers to execute arbitrary code.
The record went public on September 9, 2026 and is rated 9.2 CRITICAL under CVSS 4.0 (CVSS-B). The vector is shown below.
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
The vector describes a network-adjacent attack with low complexity, no
privileges, and no user interaction (UI:N), which is where the "zero
click image" framing in the September coverage comes from. It also carries
Attack Requirements Present (AT:P), meaning exploitation depends on
conditions that have to hold on the target. That matches exactly what I
found while reversing. The library trusts whatever geometry its caller
feeds it, so real-world exploitability hinges on which Samsung component
pushes attacker-derived dimensions into the LTN decode path. Impact on the
vulnerable system is high across confidentiality, integrity and
availability.
Per NVD, the affected configurations are Samsung mobile devices running Android 14, 15, 16 or 17 with a patch level older than SMR Sep-2026 Release 1, and the weakness class is CWE-122 (heap-based buffer overflow), the direct consequence of an integer overflow (CWE-190) in the allocation arithmetic. A sibling bug in the DNG decoder of the same library (CVE-2026-21095 / SVE-2026-3247) was fixed in the same bulletin. This repository covers the JPEG one only.
The CVE record describes potential remote code execution. This repository does not attempt to reproduce that impact. My work here covers the vulnerable native path and a local crash reproducer, nothing more.
libimagecodec.quram.so is a closed-source image codec written by
Quramsoft that Samsung ships on all recent Galaxy devices. It sits above
the Android platform decoders. When a Samsung app (Gallery, camera
pipeline, messaging previews) wants a fast or streaming decode of a JPEG,
it calls into this library instead of Skia. Two builds ship on a typical
device, /system/lib64/libimagecodec.quram.so and a 32-bit twin under
/system/lib/ that is mapped by mediaserver32. I verified the 64-bit
one is loaded inside the Gallery process on my test phone.
The function that contains the bug is the JNI entry point behind
com.quramsoft.images.QuramBitmapFactory
.DecodeJPEGFromFileIter4LTNToNativeBufferArray(...)
"LTN" is the Samsung lock-to-native iteration decode, the mode where the caller supplies the output geometry itself (row stride, total height, and how many rows each iteration chunk should cover) and the library decodes the image block by block into caller-managed native buffers. The camera burst path is the natural consumer of this mode.
The screenshot below is the decompiled pseudocode of the JNI entry point,
taken directly in IDA Pro from the vulnerable arm64 build of the library
(BuildId d49d229541cc09afa04a97266252f7f716e4f7aa). It runs from the
color-config selection down to the two memsets, the complete life of the
values that wrap. The arguments that matter are as follows. a4 is the
decode-mode flag (must be 1 or 3), a5 is the caller-supplied row stride
(kept in v14), a9 is the caller-supplied iteration row count, and
*(_DWORD *)(a3 + 8) is the inPreferredConfig value stored inside the
decode-info struct, which selects v22 (bytes per pixel) and v23 (plane
count). v58 is just v22 copied into a stack slot.

Three 32-bit products go wrong at once, on the lines the image shows. The
mistake itself is an integer overflow (CWE-190) in unchecked 32-bit
arithmetic, and its memory-safety effect is the heap-based buffer overflow
(CWE-122) that the CVE record carries. The allocation (0xb2d8c) is
4 * v28 * v22 * (v29 >> 1). For large strides
and iteration heights it silently wraps modulo 2³², and the 4.29 GB
request becomes a 262,144-byte chunk that malloc happily grants. Then
v31 = v26 * v14 wraps negative, to −2,147,450,881, and v32 = v31 * bpp
wraps again, to a harmless +65,534. The zero-fill at 0xb2dc0 therefore
quietly clears 65,534 bytes inside the chunk and returns. The chroma fill
is where it detonates. Its size is v32 − v31, which lands on
−2,147,450,881, and the sxtw x2, w8 in front of the call widens that
negative int into a size_t of roughly 2⁶⁴. Its destination is
buf + v31, two gigabytes below the chunk. That call (0xb2de0, the
+536 frame in the tombstone) sweeps 0x80 bytes across two gigabytes of
address space until it walks into an unmapped page, and that is the
SIGSEGV. If heap layout is luckier, it corrupts neighbouring chunks
silently instead, and that part is someone else's research.