Nextjs, Unauthenticated Remote Code Execution, GHSA-2xp9-vwfh-vxw4 (Critical) -DC-Sep2026-2270

Listen to this Post

A critical vulnerability has been discovered in Next.js that allows unauthenticated attackers to execute arbitrary code remotely via the Image Optimization API when processing AVIF files. This flaw stems from a heap buffer overflow in the underlying `libheif` C library, which is used by the `sharp` image processing package that Next.js relies on for image optimization. The issue is tracked as GHSA-2xp9-vwfh-vxw4 and carries a CVSS v4 score of 9.5 (Critical).
The vulnerability affects all Next.js versions from 10.0.0 through 15.5.23 and 16.0.0 through 16.3.2. It is triggered when an application explicitly enables AVIF optimization by adding `image/avif` to the `formats` configuration in next.config.js; deployments without this configuration are not exposed. The root cause lies in `libheif` versions up to v1.23.1, where a crafted AVIF file containing nested identity-derivation and auxiliary item references causes the library to build a decoded image with two Alpha plane entries at different bit depths. The scaler allocates a destination buffer sized for the first 8‑bit Alpha entry but then writes 16‑bit sample values from the second entry, overwriting approximately 16,384 bytes past the allocation boundary.
An unauthenticated attacker can exploit this by sending a malicious AVIF file to the Next.js image optimization endpoint (typically `/api/next/image` or similar paths). The application passes the file to sharp, which invokes the vulnerable `libheif` parser. The memory corruption allows the attacker to overwrite sensitive structures and execute arbitrary code within the context of the application process. Researchers rootxharsh (Finder) and KarimPwnz (Coordinator) released a full Python proof‑of‑concept that reproduces the heap corruption under an address sanitizer build. They confirmed remote code execution on multiple applications.
Vercel released patched versions 15.5.24 (Maintenance LTS) and 16.3.3 (Active LTS) on August 25, 2026. The patches disable AVIF optimization entirely until an upstream fix propagates from libheif. Applications hosted on Vercel are protected and require no upgrade.

DailyCVE Form:

Platform: ……. Next.js
Version: …….. 10.0.0–15.5.23, 16.0.0–16.3.2
Vulnerability :…… Heap buffer overflow (RCE)
Severity: ……. Critical (CVSS 9.5)
date: ………. Aug 25, 2026

Prediction: …… Patch expected (released)

What Undercode Say:

Upgrade immediately to the patched versions:

npm install [email protected] for 15.x line
npm install [email protected] for 16.x line

If upgrade is not feasible, disable AVIF optimization in next.config.js:

module.exports = {
images: {
formats: ['image/webp'], // remove 'image/avif'
},
};

Verify your current Next.js version:

npm list next

Exploit: (Educational Purposes!)

A crafted AVIF file triggers the overflow by supplying nested identity‑derivation and auxiliary item references that produce two Alpha plane entries at 8‑bit and 16‑bit depths. The scaler allocates a buffer for the 8‑bit entry but writes 16‑bit values, overflowing by ~16 KB. The following Python snippet (adapted from the researchers’ PoC) generates a malicious AVIF structure:

import avif
Create AVIF with nested identity-derivation and auxiliary items
... (full exploit code omitted for security)

Note: This is for educational understanding only; do not use maliciously.

Protection:

  • Upgrade to Next.js 15.5.24 or 16.3.3 immediately.
  • Disable AVIF in `next.config.js` if patching is delayed.
  • Deploy WAF rules to inspect and filter suspicious image uploads to `/api/next/image` endpoints.
  • Monitor logs for anomalous high‑frequency or large‑payload image requests.

Impact:

Successful exploitation allows an unauthenticated attacker to achieve full remote code execution on the server hosting the Next.js application. This compromises the confidentiality, integrity, and availability of the application and its underlying infrastructure. Attackers can exfiltrate environment variables, source code, pivot internally, install malware, and disrupt services. Given Next.js’s widespread adoption, this poses a high risk to enterprise, government, and consumer platforms.

🎯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

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top