HSEC-2026-0017: Out-of-bounds writes in BMP RLE and TIFF strip decoding

Published Nov 17, 2026
·
Updated

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 BIRLE8/BIRLE4 (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).

Affected Software

1 affected componentFixes available
hackage/juicypixels>=3.1.3<3.3.10
3.3.10

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade hackage/JuicyPixels to a version that resolves this vulnerability.

    Fixed in 3.3.10
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 3.3.10

Event History

Nov 17, 2026
Advisory Published
via OSV·09:55 AM
Data Sourced
via OSV·09:55 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

What input and access does an attacker need to exploit this?

An attacker needs to cause the application to decode a malicious BMP or TIFF image. The vulnerable paths are reachable through ordinary image decoding, including Codec.Picture.decodeImage and the format-specific decoders; no privileges or user interaction are required according to the supplied severity vector.

2

Which image encodings are affected?

Affected BMP inputs use BI_RLE8 or BI_RLE4 run-length encoding. Affected TIFF inputs use uncompressed or PackBits contiguous strips.

3

What is the practical impact of successful exploitation?

A malicious image can cause heap memory adjacent to the decoded raster to be overwritten with attacker-selected values at attacker-controlled offsets. The stated impact includes compromise of confidentiality, integrity, and availability.

4

Are large image dimensions required for the BMP issue?

Large BMP headers can cause the 32-bit Int32 pixel-buffer size calculation to wrap to a zero-length allocation. Independently, BMP end-of-line, vertical-delta, and horizontal-delta controls can move the write cursor without enforced bounds.

5

What should be prioritized if patching cannot happen immediately?

Prioritize preventing decoding of untrusted BMP BI_RLE8/BI_RLE4 and TIFF images with uncompressed or PackBits contiguous strips. The provided data does not describe a configuration workaround or detection method.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203