HSEC-2026-0017: Out-of-bounds writes in BMP RLE and TIFF strip decoding
Published 2026-11-17 · Updated 2026-11-17
Summary
JuicyPixels contains multiple out-of-bounds write vulnerabilities in its BMP and TIFF decoders triggered by integer wrapping and missing bounds checks. Users of the library must upgrade to version 3.3.10 or later to mitigate potential heap corruption and remote code execution risks.
Who is affected
The vulnerability affects applications that decode maliciously crafted BMP or TIFF image files using the JuicyPixels library. Attackers can achieve heap memory corruption, leading to application crashes, potential session hijacking, or arbitrary command execution depending on heap layout.
Exploitability
The vulnerability is not documented with an official CVSS vector or EPSS score, and it is not listed in the CISA Known Exploited Vulnerabilities catalog. However, the report demonstrates that RCE is achievable via heap grooming on GHC 9.6 / linux-amd64 systems.
Remediation
Upgrade the JuicyPixels package to version 3.3.10 or later.
Verify that the application code does not rely on the vulnerable BMP RLE or TIFF strip decoding paths if an upgrade is delayed.
How to check your project
Check cabal.project.freeze or stack.yaml.lock files for JuicyPixels versions in the range [3.1.3, 3.3.9].
Use 'cabal list-bin' or similar build tool commands to verify the resolved version of JuicyPixels in the dependency graph.
Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
Ecosystem
Package
Affected versions
Fixed in
Upgrade
Hackage
JuicyPixels
>= 3.1.3, < 3.3.10
3.3.10
-
FAQ
Does upgrading to 3.3.10 fully resolve all vulnerabilities?
No. The report notes residual risk in the shared LZW decoder (Codec.Picture.Gif.Internal.LZW) which remains unaddressed in version 3.3.10.
Is this vulnerability limited to specific operating systems?
The reported exploitability was demonstrated on GHC 9.6 / linux-amd64, but the underlying out-of-bounds write primitive exists within the library code and may affect other platforms.
What is the primary mechanism of the vulnerability?
The flaw stems from 32-bit integer arithmetic wrapping during buffer size calculations and a lack of bounds checking on destination cursors during RLE and strip decoding processes.
Original advisory description
# Out-of-bounds writes in BMP RLE and TIFF strip decoding
JuicyPixels contains independent out-of-bounds writes reachable from ordinary
image decoding (`Codec.Picture.decodeImage` and the format-specific decoders):
1. **BMP `BI_RLE8`/`BI_RLE4`** (`Codec.Picture.Bitmap.decodeImageY8RLE`): the
pixel buffer size is computed with 32-bit `Int32` arithmetic and wraps to a
zero-length allocation for large headers; end-of-line and vertical-delta
control codes move the destination cursor without a bound, and the
horizontal delta jump is unclamped. Every run writes attacker-chosen bytes
through `M.unsafeWrite` at the cursor position - negative offsets before
the raster, arbitrary offsets against a wrapped allocation, and up to 255
bytes past it.
2. **TIFF uncompressed/PackBits contiguous strips**
(`Codec.Picture.Tiff.gatherStrips`, `copyByteString`, `unpackPackBit`):
strip copies have no destination bound and the per-strip size computation
wraps negative for strips starting past the raster, so excess strips copy
attacker-chosen bytes past the end of the allocated raster.
Impact: heap memory adjacent to the decoded image is corrupted with
attacker-selected values and offsets through maliciously crafted BMP or TIFF
files. Beyond corruption, exploitation primitives were demonstrated
end-to-end on GHC 9.6 / linux-amd64: a crafted BMP deterministically crashed
the process via the wrapped allocation; against a warp-based service a single
uploaded BMP overwrote another request's in-memory session blob, observed in
the victim's own HTTP response (12 of 12 cycles); and with heap grooming the
write primitive was used to redirect a lazily-evaluated top-level `String`
passed to `callCommand`, executing attacker-supplied commands (3 of 3 runs).
These are relative-offset primitives: the demonstrated RCE depends on heap
layout and linkage and is not a guaranteed arbitrary-address write.
The fix, released in 3.3.10, validates the declared pixel count centrally in
`decodeBitmapWithPaletteAndMetadata` (cap 2^29 pixels, i.e. 2 GiB of RGBA8),
computes all decoder buffer sizes in exact 64-bit `Int` arithmetic, clips
out-of-bounds BMP RLE writes to the raster (zero-filling skipped pixels,
matching the clipping behaviour of the non-RLE decoders and the Windows WIC
decoder), bounds TIFF strip copies at the destination buffer, and clamps
strip counts at the raster boundary. Malformed-but-decodable files keep
decoding instead of failing.
Residual risk in 3.3.10: the shared GIF/TIFF LZW decoder
(`Codec.Picture.Gif.Internal.LZW`) retains an unguarded single-byte
KwKwK write reachable from the same TIFF/GIF decode paths; it is
documented as a follow-up and is not addressed by this release.
Credit: external vulnerability report by Akash Sebastian (@akashseb) and Tomer
Fichman (irregular).