MediumGHSA-g5qg-72qw-gw5vCVE-2025-57752

Next.js Affected by Cache Key Confusion for Image Optimization API Routes

Published 29 Aug 2025 · Updated 10 Sept 2026

Affected packages

nextnpm
Affected
>=0.9.9 <14.2.31
Fixed in
14.2.31
Update to the fixed version for your release line, for example:npm install next@14.2.31
nextnpm
Affected
>=15.0.0 <15.4.5
Fixed in
15.4.5
Update to the fixed version for your release line, for example:npm install next@15.4.5

Details

A vulnerability in Next.js Image Optimization has been fixed in v15.4.5 and v14.2.31. 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.

All users are encouraged to upgrade if they use API routes to serve images that depend on request headers and have image optimization enabled.

More details at Vercel Changelog

Is GHSA-g5qg-72qw-gw5v in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected next, and gives you the command that fixes it.

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.