Junglewise Threat Intelligence

sharp remote code execution via malformed HEIF image

Severity: medium · CVSS 4 · Published 2026-09-08

Executive brief

Sharp is a Node.js image processing library widely used for thumbnail generation, image conversion, and other image manipulation tasks in web applications. Upstream vulnerabilities in the libheif dependency can allow remote code execution when processing untrusted image files, potentially leading to full system compromise or data theft on affected servers.

Technical details

Multiple critical vulnerabilities have been discovered in the libheif dependency (versions ≤1.23.1) that stem from incorrect assumptions about image geometry and plane handling. Specifically, the code assumes that a HeifPixelImage's logical dimensions accurately describe every channel plane and that each heif_channel is backed by at most one plane—neither of which is enforced. By crafting a malformed HEIF/AVIF image with derived items (iden, auxl chains), an attacker can trigger out-of-bounds reads and writes, leading to RCE. Attack vector is local/adjacent since sharp itself has no networking, but applications using sharp to process untrusted uploaded images are at risk. The vulnerability affects sharp versions prior to 0.35.4, which bundles libheif 1.23.2. Patches are available; workaround is to disable HEIF decoding via sharp.block().

Affected products

  • lovell sharp < 0.35.4
  • struktur libheif <= 1.23.1

Timeline

  • 2026-09-08: disclosed: GHSA-rgj7-g3m4-5g8c published
  • 2026-09-08: patched: sharp 0.35.4 released with libheif 1.23.2

References