Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-96889-nextjs-rce — Lab PoC for CVE-2026-96889: Next.js Image Optimization SVG typed as AVIF reaches librsvg UAF (RUSTSEC-2026-0305). Unauthenticated RCE on glibc Linux. | Kitploit
Tools/GitHubGitHub/lion9453/cve-2026-96889-nextjs-rce
Payload GenerationVulnerability AnalysisExploitationReverse EngineeringWeb Application ExploitationWeb SecurityRemote Access ToolBinary Exploitation
GitHub
lion9453/cve-2026-96889-nextjs-rce

CVE-2026-96889-nextjs-rce

Lab PoC for CVE-2026-96889: Next.js Image Optimization SVG typed as AVIF reaches librsvg UAF (RUSTSEC-2026-0305). Unauthenticated RCE on glibc Linux.

View Repository
291 month agoNot yet reviewed
Share

CVE-2026-96889 — Image Optimization SVG → librsvg use-after-free

Lab proof of concept for unauthenticated RCE (or DoS) through Next.js /_next/image on glibc Linux. Run it only against systems you own.

A document that starts <!--ftypavif--> is a legal SVG, but Next's magic sniffer types it as image/avif. AVIF is not in BYPASS_TYPES, so the buffer reaches sharp → libvips → librsvg. librsvg then frees an xmlEntity that libxml2 is still using (RUSTSEC-2026-0305).

Usable for RCE on official non-PIE node v24.20.0 and v22.23.3 (same chain, different addresses). node v20.20.2 is DoS only (SIGSEGV). sharp 0.35.5 (librsvg 2.63.2) is immune.

GHSAGHSA-2464-fhr4-w9xw
CVECVE-2026-96889
SeverityCritical, CVSS 9.5
Affectednext >= 10.0.0 <= 15.5.27, > 16.0.0 <= 16.4.0
Fixednext 15.5.28 / 16.4.1 (pins sharp >= 0.35.5)
Platformglibc Linux
Workaroundsharp >= 0.35.5. images.unoptimized: true also removes the surface.

The 16.4.1 / 15.5.28 patches do not change content-type sniffing. A deployment that upgraded Next but left sharp at 0.35.4 is still vulnerable. Check the decoder (sharp.versions / /sharpinfo), not the Next version string.

Supported / tested

Supported is the vendor advisory: next >= 10.0.0 <= 15.5.27 and > 16.0.0 <= 16.4.0, glibc Linux, sharp < 0.35.5. Tested is what this repo actually ran.

VersionThis lab
next16.4.0 + sharp 0.35.4UAF probe + RCE (app/)
next15.5.27 + sharp 0.35.4same rce.svg, no padding change (app15/)
next16.4.1 + sharp 0.35.5fixed (payload rasterizes)
next16.4.1 + sharp 0.35.4vulnerable again (sniffing unchanged)
next15.5.28 (stock)vendor pin sharp >= 0.35.5; patched HTTP run is 16.4.1
next10.0.0 – 15.5.26advisory range, not re-run
sharp0.35.4 → libvips 8.18.6 / librsvg 2.62.91fires (harness/vuln)
sharp0.35.5 → libvips 8.18.7 / librsvg 2.63.2clean (harness/fixed)
nodeofficial linux-x64 v24.20.0 (non-PIE EXEC)RCE
nodeofficial linux-x64 v22.23.3RCE (same chain, different addresses)
nodeofficial linux-x64 v20.20.2DoS (SIGSEGV)
OSglibc x86-64 Linuxrequired for the shipped ROP tables

PIE / musl / self-built node binaries are outside the shipped tables; extract addresses with harness/find-gadgets.py. 15.x also needs a sharp build that reports heif (canDecodeAvif); this lab's 0.35.4 reports heif 1.23.2.

Root cause

Librarylibrsvg (Rust, statically linked into libvips), not sharp and not Next
Sharp advisoryGHSA-wq5f-xc86-pv6w (sharp < 0.35.5)
RustSecRUSTSEC-2026-0305, Use-after-free when XML includes have duplicated entities
Fixlibrsvg 2.63.2 (8a1b0cd3 — “no longer frees xmlEntity pointers still owned by libxml2”)
Versions used heresharp 0.35.4 → libvips 8.18.6 / librsvg 2.62.91 (vulnerable); sharp 0.35.5 → libvips 8.18.7 / librsvg 2.63.2 (fixed)

Mechanism: recursive XInclude. The inner document redeclares an entity name that already exists. librsvg and libxml2 share one entity map; entity_insert() frees the outer xmlEntity that xmlCtxtParseEntity() is still using.

N ≤ 4 duplicate-name pairs rasterize on both builds; N ≥ 5 they split. The vulnerable build fails with PCDATA invalid Char value 0.

Why a plain .svg never hits this CVE

next/dist/server/image-optimizer/transform.js:

const BYPASS_TYPES = [SVG, ICO, ICNS, BMP, JXL, HEIC]
if (BYPASS_TYPES.includes(upstreamType)) {
  return { buffer: upstreamBuffer, ... }
}

/_next/image?url=/x.svg is copied back untouched. sharp is never called.

AVIF detection in detect-content-type.js is:

if ([0,0,0,0,'f','t','y','p','a','v','i','f'].every((b,i)=>!b || buffer[i]===b))
  return _imagetype.AVIF

The first four bytes are wildcards. Bytes 4..11 can live in an XML comment:

<!--ftypavif--><svg ...>

Then:

  • Next types image/avif → not in BYPASS_TYPES → sharp → librsvg
  • Not image/svg* → dangerouslyAllowSVG is never consulted (stock config works)
  • librsvg ignores the comment. The payload must not carry an <?xml …?> declaration: if it is not at byte 0, librsvg errors with XML declaration allowed only at the start of the document

AVIF is the only magic check where “starts with <!--” and “reaches sharp” are both true. HEIC has the same wildcard but is in BYPASS_TYPES.

Black-box oracle

imageOptimizerTransform() catches optimizer failures and returns the upstream buffer with the upstream type, still HTTP 200. Do not look at the status code.

Filesharp 0.35.4sharp 0.35.5
avif-control.svg (valid SVG, no entity)200 image/jpeg200 image/jpeg
avif-uaf-5.svg (5 pairs)200 image/avif — body is the payload itself200 image/jpeg
plain-baseline.svg (real SVG)400 (dangerouslyAllowSVG: false)400

Vulnerable: the body starts with <!--ftypavif-->. A raster never does. The control must rasterize too: the same catch also fires when sharp is not installed, so a text fallback alone is ambiguous.

Fetch in this order: liveness → payload → control. The control is itself an SVG parse and moves the heap, so it goes last.

The optimizer caches rasters on disk per url+w+q. After a key has succeeded once, later requests never reach librsvg. q is restricted to images.qualities (default: 75). Force a cold fetch with --w, which must be one of images.imageSizes / deviceSizes.

RCE

Public PoCs for this librsvg UAF (EQSTLab CVE-2026-94545 and others) target next/og (ImageResponse). exploit.mjs uses the same inner documents and padding, with an outer wrapper of <!--ftypavif--> + <xi:include> so the bytes reach /_next/image.

Prerequisitenon-PIE node binary (official linux-x64 tarballs are Type: EXEC), glibc, x86-64 Linux. No leak — addresses are compile-time constants
GadgetsFrom official node v24.20.0 / v22.23.3. Built-in tables in exploit.mjs; extract more with harness/find-gadgets.py
CarrierROP chain (≤ 60 qwords) as shortest IEEE-754 decimal text inside <path d="…">. 8 bytes ↔ double ↔ text is lossless
Command length≤ 71 bytes
VerificationOut of band. execve replaces the worker; stdout never returns in the HTTP response. The connection drops
nodesharp / librsvgResult
24.20.00.35.4 / 2.62.91RCE
22.23.30.35.4 / 2.62.91RCE (same chain shape, different addresses)
20.20.20.35.4 / 2.62.91DoS (SIGSEGV). Call slot does not land on the chain
24.20.00.35.5 / 2.63.2Rasterized, process lives

Without --table, exploit.mjs tries 24 → 22 → 20 and waits --restart-wait (default 25 s) between shots for the host to bring the worker back.

The same payload file works on Next 16.4.0 and 15.5.27 with no padding change. 16.4.1 + sharp 0.35.5 is fixed; 16.4.1 with sharp swapped back to 0.35.4 is usable again.

The command bytes shift the ROP doubles inside the buffer. If a given --command only crashes, change the spelling (spaces around > are free) or --pad and retry after the worker restarts. Misses are SIGSEGV.

Delivery

The payload cannot ride in the URL (data: is rejected; url is capped at 3072 chars). The target has to be able to fetch the file.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    916
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    558
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    370
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    360
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    317
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    289

Explore all tools

Browse our collection of tools

View all tools →