What’s Vulnerable › Vulnerabilities

CVE-2025-57752: Next.js Affected by Cache Key Confusion for Image Optimization API Routes

Description

Next.js is a React framework for building full-stack web applications. In versions before 14.2.31 and from 15.0.0 to before 15.4.5, Next.js Image Optimization API routes are affected by cache key confusion. When images returned from API routes vary based on request headers (such as Cookie or Authorization), these responses could be incorrectly cached and served to unauthorized users due to a cache key confusion bug. This vulnerability has been fixed in Next.js versions 14.2.31 and 15.4.5. All users are encouraged to upgrade if they use API routes to serve images that depend on request headers and have image optimization enabled.

Affected products

How to fix

Upgrade to a fixed version: Next.js 14.2.31, 15.4.5; Npm Next 14.2.31, 15.4.5. Check the vendor advisory for mitigations.

References

Get alerted when CVE-2025-57752 or the next vulnerability affects your stack