CVE-2026-27980: Next.js: Unbounded next/image disk cache growth can exhaust storage
Summary The default Next.js image optimization disk cache (/next/image) did not have a configurable upper bound, allowing unbounded cache growth.
Impact An attacker could generate many unique image-optimization variants and exhaust disk space, causing denial of service.
Patches Fixed 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.
Workarounds If upgrade is not immediately possible: - Periodically clean .next/cache/images. - Reduce variant cardinality (e.g., tighten values for images.localPatterns, images.remotePatterns, and images.qualities)
Other sources
Summary The default Next.js image optimization disk cache (/next/image) did not have a configurable upper bound, allowing unbounded cache growth.
Impact An attacker could generate many unique image-optimization variants and exhaust disk space, causing denial of service. Note that this does not impact platforms that have their own image optimization capabilities, such as Vercel.
Patches Fixed 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.
Workarounds If upgrade is not immediately possible: - Periodically clean .next/cache/images. - Reduce variant cardinality (e.g., tighten values for images.localPatterns, images.remotePatterns, and images.qualities)
— GitHub
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).
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/nextto a version that resolves this vulnerability.Fixed in 16.1.7 - Upgrade
Upgrade
npm/nextto a version that resolves this vulnerability.Fixed in 15.5.14 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 16.1.7 - Configuration
Set images.maximumDiskCacheSize to 0 to disable the disk cache (limits unbounded growth)
Next.js next/image (image optimization disk cache at /_next/image) images.maximumDiskCacheSize = 0 - Configuration
If upgrade is not possible, reduce variant cardinality by tightening images.localPatterns, images.remotePatterns, and images.qualities
Next.js next/image (variant generation controls) images.localPatterns / images.remotePatterns / images.qualities = tighter values - Operational
If upgrade is not possible, periodically clean .next/cache/images to prevent disk exhaustion from cached image optimization variants
Event History
Frequently Asked Questions
What is the severity of CVE-2026-27980?
CVE-2026-27980 is categorized as a moderate severity vulnerability due to its potential for causing denial of service.
How do I fix CVE-2026-27980?
To fix CVE-2026-27980, upgrade Next.js to version 16.1.7 or later.
What is the impact of CVE-2026-27980?
CVE-2026-27980 allows attackers to exhaust disk space by generating numerous unique image-optimization variants.
What software is affected by CVE-2026-27980?
CVE-2026-27980 affects Next.js versions from 10.0.0 to 16.1.6.
Is there a configuration option to limit cache growth in CVE-2026-27980?
By default, there is no configurable upper bound for cache growth in affected versions of Next.js.