Vulnerability · Published Aug 29, 2025 · Assigned by GitHub_M

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

Medium 6.2

In plain English

A medium-severity security flaw in next.js from vercel. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 28% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)6.2Medium
Exploit odds (30 days)0.3%top 71.6% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official 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 packages & fixed versions

EcosystemPackageFixed inAdvisory
npmnext14.2.31GHSA-g5qg-72qw-gw5v
npmnext15.4.5GHSA-g5qg-72qw-gw5v

Affected products (as reported)

VendorProductVersions
vercel next.js >= 15.0.0, < 15.4.5< 14.2.31

Weakness: CWE-524 · Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

References