HSEC-2026-0017

See a problem?
Import Source
https://github.com/haskell/security-advisories/blob/generated/osv-export/2026/HSEC-2026-0017.json
JSON Data
https://api.osv.dev/v1/vulns/HSEC-2026-0017
Published
2026-11-17T09:55:51Z
Modified
2026-11-17T10:00:02Z
Summary
Out-of-bounds writes in BMP RLE and TIFF strip decoding
Details

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).

Database specific
{
    "home":  "https://github.com/haskell/security-advisories",
    "osvs":  "https://raw.githubusercontent.com/haskell/security-advisories/refs/heads/generated/osv-export",
    "repository":  "https://github.com/haskell/security-advisories"
}
References

Affected packages

Hackage / JuicyPixels

Package

Name
JuicyPixels
Purl
pkg:hackage/JuicyPixels

Severity

  • 9.8 (Critical) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H CVSS Calculator

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.1.3
Fixed
3.3.10

Affected versions

3.*
3.1.3
3.1.3.1
3.1.3.2
3.1.3.3
3.1.4
3.1.4.1
3.1.5
3.1.5.1
3.1.5.2
3.1.6
3.1.6.1
3.1.7
3.1.7.1
3.2
3.2.1
3.2.2
3.2.3
3.2.3.1
3.2.3.2
3.2.4
3.2.5
3.2.5.1
3.2.5.2
3.2.5.3
3.2.6
3.2.6.1
3.2.6.2
3.2.6.3
3.2.6.4
3.2.7
3.2.7.1
3.2.7.2
3.2.8
3.2.8.1
3.2.8.2
3.2.8.3
3.2.9
3.2.9.1
3.2.9.2
3.2.9.3
3.2.9.4
3.2.9.5
3.3
3.3.1
3.3.2
3.3.3
3.3.3.1
3.3.4
3.3.5
3.3.6
3.3.7
3.3.8
3.3.9

Database specific

human_link
"https://github.com/haskell/security-advisories/tree/main/advisories/published/2026/HSEC-2026-0017.md"
osv
"https://raw.githubusercontent.com/haskell/security-advisories/refs/heads/generated/osv-export/2026/HSEC-2026-0017.json"
source
"https://github.com/haskell/security-advisories/blob/generated/osv-export/2026/HSEC-2026-0017.json"