Reported libheif Overflow Enables RCE Through Next.js Sharp Uploads
Vulnerability Disclosure · 3 sources · Updated 2mo ago · First seen Sep 28, 2026

Research published by Fortbridge describes CVE-2026-32740 as a heap-buffer overflow in libheif's HeifPixelImage::copy_image_to() while decoding crafted HEIF or AVIF grid images with 4:2:0 chroma planes. In a deliberately vulnerable Next.js upload application using Sharp—whose native image-processing stack includes libvips and libheif—the researchers report achieving remote code execution by leaking pixel data to bypass ASLR, corrupting a libheif plane-map structure for a constrained write primitive, and redirecting libvips' memcpy GOT entry to an internal GModule loader. The demonstrated payload was an attacker-supplied ELF shared object disguised as a JPEG, executed when loaded by the process.
The reported exploit succeeded in 20 of 20 fresh test processes on specified Ubuntu and Debian profiles, but the authors state that exploitation relies on exact native-library versions, allocator behavior, upload handling, and binary layout. A Reddit post amplified the claim but provided no independent validation, affected-version range, vendor advisory, or confirmation of exploitation in the wild. Organizations running Next.js services that accept untrusted HEIF or AVIF uploads through Sharp should identify bundled libheif versions, upgrade to libheif 1.22.0 or later and rebuild native dependencies where applicable, and isolate or disable HEIF/AVIF processing until their deployments are verified.


