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.
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
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| npm | next | 14.2.31 | GHSA-g5qg-72qw-gw5v |
| npm | next | 15.4.5 | GHSA-g5qg-72qw-gw5v |
Affected products (as reported)
Weakness: CWE-524 · Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
References
- https://github.com/vercel/next.js/security/advisories/GHSA-g5qg-72qw-gw5v x_refsource_CONFIRM
- https://github.com/vercel/next.js/pull/82114 x_refsource_MISC
- https://github.com/vercel/next.js/commit/6b12c60c61ee80cb0443ccd20de82ca9b4422ddd x_refsource_MISC
- https://vercel.com/changelog/cve-2025-57752 x_refsource_MISC