← back
CVE-2026-27980

Next.js: Unbounded next/image disk cache growth can exhaust storage

CVSS 6.9 MEDIUMEPSS 0.7%CWE-400
In short

Next.js's image optimization feature stores cached images on disk without a size limit, allowing an attacker to fill up your server's storage by requesting many different image variants. This can crash your application and make your website unavailable.

Technical detail

CVE-2026-27980 affects Next.js versions 10.0.0 to 16.1.6 where the `/_next/image` cache directory grows unbounded without enforced limits. An attacker can exploit CWE-400 (Uncontrolled Resource Consumption) by crafting requests with varied image optimization parameters to exhaust disk space, resulting in denial of service. Mitigation requires upgrading to 16.1.7+ which implements LRU eviction via `images.maximumDiskCacheSize`, or temporarily cleaning cache directories and restricting image variant generation patterns.

Summary generated and translated by AI from the official description.
Next.js is a React framework for building full-stack web applications. Starting in version 10.0.0 and prior to version 16.1.7, the default Next.js image optimization disk cache (`/_next/image`) did not have a configurable upper bound, allowing unbounded cache growth. An attacker could generate many unique image-optimization variants and exhaust disk space, causing denial of service. This is fixed in version 16.1.7 by adding an LRU-backed disk cache with `images.maximumDiskCacheSize`, including eviction of least-recently-used entries when the limit is exceeded. Setting `maximumDiskCacheSize: 0` disables disk caching. If upgrading is not immediately possible, periodically clean `.next/cache/images` and/or reduce variant cardinality (e.g., tighten values for `images.localPatterns`, `images.remotePatterns`, and `images.qualities`).
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
Affected products
vercel · next.js

Want to know if your infrastructure is exposed to this?

Talk to TrueHacking →