Skip to content

GHSA-rgj7-g3m4-5g8c CVE-2026-114112

sharp: Vulnerabilities in libheif: GHSA-g89c-p67h-r497 and GHSA-2jg2-4ch7-h545

High npm
Severity
8.9 / 10
High · CVSS 4.0
Exploit chance (EPSS)
0.24%
Chance of exploitation in the next 30 days. Higher than 15.35% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-122 Heap-based Buffer Overflow
Fix
0.35.4
Upgrade sharp to this version or later

Description

Impact

A number of vulnerabilities, two rated as "Critical" severity using CVSSv3, have been discovered and fixed in the upstream libheif dependency. These can lead to possible remote code execution (RCE) on glibc-based Linux when run under certain conditions.

The attack vector for these claims to be "network" however sharp does not provide any networking features so this vulnerability is down-rated to a "High" severity using CVSSv4 but please note its Subsequent System Impact.

Those processing untrusted input with versions of sharp prior to 0.35.4 are affected.

Patches

Using prebuilt binaries provided by sharp?

Most people rely on the prebuilt binaries provided by sharp.

Please upgrade sharp to the latest version, currently 0.35.4, which provides libheif 1.23.2.

Using a globally-installed libheif?

Please ensure you are using the latest libheif 1.23.2.

Workarounds

Add the following to your code to prevent sharp from decoding AVIF images.

sharp.block({ operation: ["VipsForeignLoadHeif"] });

Ensure you are using a node executable binary compiled as a Position Independent Executable (PIE). Most Linux package managers already do this for protection against RCE however be warned that the "official" Node.js binaries do not.

References

Affected versions

npm

PackageVulnerableFixed in
sharp
< 0.35.4
0.35.4
sharp
< 0.35.4
0.35.4

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

sharp npm → 0.35.4

npm
npm install sharp@0.35.4
yarn
yarn add sharp@0.35.4
pnpm
pnpm add sharp@0.35.4

Severity breakdown

CVSS 4.0 8.9

CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H

Attack vector
Local
Attack complexity
Low
Attack requirements
Present
Privileges required
None
User interaction
None
Confidentiality (vulnerable system)
High
Integrity (vulnerable system)
High
Availability (vulnerable system)
High
Confidentiality (subsequent systems)
High
Integrity (subsequent systems)
High
Availability (subsequent systems)
High

Weakness

CWE-122: Heap-based Buffer Overflow

A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().

How to prevent it
  • Pre-design: Use a language or compiler that performs automatic bounds checking.
  • Architecture and Design: Use an abstraction library to abstract away risky APIs. Not a complete solution.
  • Operation, Build and Compilation: Use automatic buffer overflow detection mechanisms that are offered by certain compilers or compiler extensions. Examples include: the Microsoft Visual Studio /GS flag, Fedora/Red Hat FORTIFY_SOURCE GCC flag, StackGuard, and ProPolice, which provide various mechanisms including canary-based detection and range/index checking. D3-SFCV (Stack Frame Canary Validation) from D3FEND [REF-1334] discusses canary-based detection in detail.
  • Operation, Build and Compilation: Run or compile the software using features or extensions that randomly arrange the positions of a program's executable and libraries in memory. Because this makes the addresses unpredictable, it can prevent an attacker from reliably jumping to exploitable code. Examples include Address Space Layout Randomization (ASLR) [REF-58] [REF-60] and Position-Independent Executables (PIE) [REF-64]. Imported modules may be similarly realigned if their default memory addresses conflict with other modules, in a process known as "rebasing" (for Windows) and "prelinking" (for Linux) [REF-1332] using randomly generated addresses. ASLR for libraries cannot be used in conjunction with prelink since it would require relocating the libraries at run-time, defeating the whole purpose of prelinking. For more information on these techniques see D3-SAOR (Segment Address Offset Randomization) from D3FEND [REF-1335].
  • Implementation: Implement and perform bounds checking on input.
  • Implementation: Do not use dangerous functions such as gets. Look for their safe equivalent, which checks for the boundary.
  • Operation: Use OS-level preventative functionality. This is not a complete solution, but it provides some defense in depth.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-wq5f-xc86-pv6w
sharp : Vulnerability in librsvg dependency CVE-2026-96889
High Also affects sharp
GHSA-f88m-g3jw-g9cj
sharp inherited vulnerabilities in libvips: CVE-2026-33327, CVE-2026-33328, CVE-2026-35590, CVE-2026-35591
High Also affects sharp
GHSA-54xq-cgqr-rpm3
sharp vulnerability in libwebp dependency CVE-2023-4863
High Also affects sharp
GHSA-gp95-ppv5-3jc5
sharp vulnerable to Command Injection in post-installation over build environment
Medium Also affects sharp
GHSA-8g5g-8vmr-9782
Pillow: Heap buffer overflow in ImagingJpegDecode
Critical Same weakness, CWE-122
GHSA-5x8w-8jj5-q52h
Pillow: Heap buffer overflow in FlashPix (FPX) JPEG decoding leads to code execution
Critical Same weakness, CWE-122
GHSA-462x-pgg6-55fp
Pillow tiled-TIFF decoder reads past tile buffer in copy4 (Unpack.c:1290)
High Same weakness, CWE-122
GHSA-332p-7hrc-92wf
Pillow: Heap buffer overflow in _tiffWriteProc when saving TIFF to BytesIO
Critical Same weakness, CWE-122
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor