Next.js self-hosted applications vulnerable to DoS via Image Optimizer remotePatterns configuration
Affected releases · next
- 16.x16.0.0 – 16.1.4Fixed in 16.1.5
- 15.x15.0.0 – 15.5.9Fixed in 15.5.10
- 14.x14.0.0 – 14.2.35No fix on this line yet
- 13.x and older10.0.0 – 13.5.11No fix, no longer updated
On 16.x, the newest line:
npm install next@16.1.5Affected
16.0.0 – 16.1.4
17 releases
Fixed
16.1.5 – 16.4.2
28 releases, latest
Affected
15.0.0 – 15.5.9
64 releases
Fixed
15.5.10 – 15.5.28
18 releases
Affected
14.0.0 – 14.2.35
46 releases
Affected
13.0.0 – 13.5.11
56 releases
Affected
12.0.0 – 12.3.7
33 releases
Affected
11.0.0 – 11.1.4
7 releases
Affected
10.0.0 – 10.2.3
18 releases
Is your project affected?
Paste your package.json, or type the range you declare for next. It is read in your browser and sent nowhere.
What happens
A DoS vulnerability exists in self-hosted Next.js applications that have remotePatterns configured for the Image Optimizer. The image optimization endpoint (/_next/image) loads external images entirely into memory without enforcing a maximum size limit, allowing an attacker to cause out-of-memory conditions by requesting optimization of arbitrarily large images. This vulnerability requires that remotePatterns is configured to allow image optimization from external domains and that the attacker can serve or control a large image on an allowed domain.
Strongly consider upgrading to 15.5.10 and 16.1.5 to reduce risk and prevent availability issues in Next applications.