Skip to content

security: bump sharp to patch libheif (HEIF Heist / CVE-2026-32882, CVE-2026-84383) - #513

Merged
saefty merged 2 commits into
mainfrom
security/heif-libheif-sharp-bump
Sep 22, 2026
Merged

saefty merged 2 commits into
mainfrom
security/heif-libheif-sharp-bump

Conversation

@saefty

@saefty saefty commented Sep 22, 2026

Copy link
Copy Markdown
Member

What

Bump sharp ^0.34.5 → ^0.35.4 in source/image-handler.

  • sharp 0.34.5 bundled @img/sharp-libvips 1.2.4 → libheif 1.20.2
  • sharp 0.35.4 bundles @img/sharp-libvips 1.3.3 → libheif 1.23.2

Lockfile regenerated with npm install --package-lock-only (no node_modules build here — CI installs).

Why

The HEIF Heist advisory (CVE-2026-32882 for libheif ≤ 1.21.2, CVE-2026-84383 for 1.22.0–1.23.1) describes heap buffer overflows in libheif/libde265, reachable when a service decodes untrusted HEIC/AVIF images — memory corruption up to RCE.

This handler decodes untrusted images from the master-images S3 bucket through sharp → libvips → libheif, and is exposed via a public Lambda Function URL (authorization_type = NONE). The bundled libheif (1.20.2) was vulnerable to CVE-2026-32882. sharp 0.35.4 pulls the patched libheif 1.23.2, which fixes both CVEs.

Wiz raises no finding for this because the CVE is filed against libheif while the SBOM only tracks the libvips wrapper version — see the fleet-wide SBOM indicator libvips < 1.3.3.

…Heist)

sharp <0.35.4 bundles @img/sharp-libvips 1.2.4 -> libheif 1.20.2, vulnerable to
the "HEIF Heist" heap overflows (CVE-2026-32882 <=1.21.2, CVE-2026-84383
1.22.0-1.23.1) reachable when decoding untrusted HEIC/AVIF images.

This handler decodes untrusted images from S3 via sharp -> libvips -> libheif and
is exposed through a public Lambda Function URL (auth NONE).

sharp 0.35.4 pulls @img/sharp-libvips 1.3.3 -> libheif 1.23.2, which fixes both.
Lockfile regenerated with `npm install --package-lock-only`.
The libheif/libvips bump re-encodes the sample images (different but valid
bytes), which broke two byte-exact golden assertions:

- test/index.spec.ts: JPEG body (EXIF density re-encoded) -> updated to the
  exact bytes CI (linux-x64) produced, taken from the failed run log.
- test/image-handler/crop.spec.ts: image_png_white_1x1 (PNG re-encoded by the
  new libvips) -> regenerated locally; bytes cross-checked against the CI diff
  window (identical), PNG output is platform-deterministic.

No behavior change; both remain valid 1x1 outputs.
@saefty
saefty merged commit 79780c6 into main Sep 22, 2026
7 checks passed
@saefty
saefty deleted the security/heif-libheif-sharp-bump branch September 22, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant