HSEC-2026-0017

Vulnerability from osv_haskell – Published: 2026-11-17 09:55 – Updated: 2026-11-17 09:55 – Source website
VLAI
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).


{
  "affected": [
    {
      "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"
      },
      "package": {
        "ecosystem": "Hackage",
        "name": "JuicyPixels"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.1.3"
            },
            {
              "fixed": "3.3.10"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "severity": [
        {
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
          "type": "CVSS_V3"
        }
      ]
    }
  ],
  "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"
  },
  "details": "# Out-of-bounds writes in BMP RLE and TIFF strip decoding\n\nJuicyPixels contains independent out-of-bounds writes reachable from ordinary\nimage decoding (`Codec.Picture.decodeImage` and the format-specific decoders):\n\n1. **BMP `BI_RLE8`/`BI_RLE4`** (`Codec.Picture.Bitmap.decodeImageY8RLE`): the\n   pixel buffer size is computed with 32-bit `Int32` arithmetic and wraps to a\n   zero-length allocation for large headers; end-of-line and vertical-delta\n   control codes move the destination cursor without a bound, and the\n   horizontal delta jump is unclamped. Every run writes attacker-chosen bytes\n   through `M.unsafeWrite` at the cursor position \u2014 negative offsets before\n   the raster, arbitrary offsets against a wrapped allocation, and up to 255\n   bytes past it.\n2. **TIFF uncompressed/PackBits contiguous strips**\n   (`Codec.Picture.Tiff.gatherStrips`, `copyByteString`, `unpackPackBit`):\n   strip copies have no destination bound and the per-strip size computation\n   wraps negative for strips starting past the raster, so excess strips copy\n   attacker-chosen bytes past the end of the allocated raster.\n\nImpact: heap memory adjacent to the decoded image is corrupted with\nattacker-selected values and offsets through maliciously crafted BMP or TIFF\nfiles. Beyond corruption, exploitation primitives were demonstrated\nend-to-end on GHC 9.6 / linux-amd64: a crafted BMP deterministically crashed\nthe process via the wrapped allocation; against a warp-based service a single\nuploaded BMP overwrote another request\u0027s in-memory session blob, observed in\nthe victim\u0027s own HTTP response (12 of 12 cycles); and with heap grooming the\nwrite primitive was used to redirect a lazily-evaluated top-level `String`\npassed to `callCommand`, executing attacker-supplied commands (3 of 3 runs).\nThese are relative-offset primitives: the demonstrated RCE depends on heap\nlayout and linkage and is not a guaranteed arbitrary-address write.\n\nThe fix, released in 3.3.10, validates the declared pixel count centrally in\n`decodeBitmapWithPaletteAndMetadata` (cap 2^29 pixels, i.e. 2 GiB of RGBA8),\ncomputes all decoder buffer sizes in exact 64-bit `Int` arithmetic, clips\nout-of-bounds BMP RLE writes to the raster (zero-filling skipped pixels,\nmatching the clipping behaviour of the non-RLE decoders and the Windows WIC\ndecoder), bounds TIFF strip copies at the destination buffer, and clamps\nstrip counts at the raster boundary. Malformed-but-decodable files keep\ndecoding instead of failing.\n\nResidual risk in 3.3.10: the shared GIF/TIFF LZW decoder\n(`Codec.Picture.Gif.Internal.LZW`) retains an unguarded single-byte\nKwKwK write reachable from the same TIFF/GIF decode paths; it is\ndocumented as a follow-up and is not addressed by this release.\n\nCredit: external vulnerability report by Akash Sebastian (@akashseb) and Tomer\nFichman (irregular).\n",
  "id": "HSEC-2026-0017",
  "modified": "2026-11-17T09:55:51Z",
  "published": "2026-11-17T09:55:51Z",
  "references": [
    {
      "type": "FIX",
      "url": "https://github.com/haskell-github-trust/Juicy.Pixels/commit/9c9a3d75ed0a998b5bfd49534a364a9e52e74ba2"
    }
  ],
  "schema_version": "1.5.0",
  "summary": "Out-of-bounds writes in BMP RLE and TIFF strip decoding"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.