Listen to this Post
The `sharp` npm package, a high-performance Node.js image processing library, relies on the upstream `libheif` library to decode and encode HEIF and AVIF image formats. In August 2026, multiple security vulnerabilities were discovered and fixed in libheif. These flaws, two of which were rated as “Critical” severity under CVSSv3, can lead to Remote Code Execution (RCE) on glibc-based Linux systems under certain conditions.
The vulnerabilities arise from improper handling of maliciously crafted HEIF/AVIF image files. Specific issues include a heap buffer overflow in the `scale_nearest_neighbor()` function triggered by duplicate alpha planes from nested image item chains (GHSA-g89c-p67h-r497), and an out-of-bounds read and write in derived-item and pixel-plane handling (GHSA-2jg2-4ch7-h545). Other vulnerabilities involve decompression bombs in brotli/zlib (GHSA-24wx-9w62-c96w), CPU and memory amplification via derived-image references (GHSA-x8xm-cm2c-cfc8), and additional out-of-bounds write and read issues.
While the upstream `libheif` vulnerabilities are classified as critical, the `sharp` maintainers have down-rated the severity to “High” for the package itself. This is because `sharp` does not provide any native networking features; the attack vector is considered “network” only for the underlying library. However, the risk remains significant for any application that processes images from untrusted or external sources. All versions of `sharp` prior to 0.35.4 are affected.
DailyCVE Form:
Platform: Node.js / Linux
Version: sharp < 0.35.4
Vulnerability: RCE / Memory Corruption
Severity: High (CVSSv4)
Date: 2026-09-08
Prediction: Patch already available (2026-08-25)
What Undercode Say:
Analytics & Verification
To check if your environment is using a vulnerable version of sharp:
npm list sharp
To check if your Node.js binary is compiled as a Position Independent Executable (PIE), which provides RCE mitigation:
readelf -h $(which node) | grep -E "Type:.(EXEC|DYN)"
A PIE binary will show Type: DYN (Shared object file). The official Node.js binaries are often not PIE-compiled, increasing risk.
Exploit: (Educational Purposes!)
Successful exploitation requires an attacker to supply a specially crafted AVIF or HEIF image to an application using a vulnerable `sharp` version. When the application processes this image, the memory corruption vulnerabilities in `libheif` can be triggered. This could allow an attacker to execute arbitrary code on the target system with the privileges of the Node.js process. A working code-execution exploit has been confirmed for one of the critical issues.
Protection:
- Upgrade
sharp: Immediately upgrade to the latest version, 0.35.4 or later. This version includes the patched `libheif` 1.23.2. - Update Global
libheif: If you use a globally-installedlibheif, ensure it is updated to version 1.23.2 or later. - Workaround (Code-Level Block): If you cannot upgrade immediately, add the following code to prevent `sharp` from decoding AVIF images:
sharp.block({ operation: ["VipsForeignLoadHeif"] }); - Use PIE-Compliant Node.js: Ensure your Node.js executable is compiled as a Position Independent Executable (PIE). Most Linux package managers provide PIE-compiled binaries, unlike the official Node.js builds.
Impact:
- Systems at Risk: Any service or application using `sharp` (prior to v0.35.4) to process HEIF/AVIF images from untrusted sources.
- Consequence: Successful exploitation can lead to full remote code execution on the underlying host operating system.
- Targeted Sectors: Web applications, content management systems, and image processing pipelines that accept user-submitted files.
🎯Let’s Practice Exploiting & Learn Patching For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

