Next.js version 14.2.21 represents a minor update over the previous stable version 14.2.20, primarily focusing on internal dependencies and potential bug fixes. Both versions maintain identical core dependencies like busboy, postcss, @next/env, styled-jsx, graceful-fs, @swc/helpers, and caniuse-lite, ensuring feature parity in basic functionality. Examining the devDependencies reveals that the vast majority of tools and versions remain consistent.
The @next/swc package, crucial for accelerated JavaScript and TypeScript compilation, sees a version bump from 14.2.20 to 14.2.21, which developers should view as a performance and compatibility improvement. The @next/polyfill-module, @next/polyfill-nomodule and @next/react-refresh-utils are also updated to the 14.2.21 version. The optional dependencies related to @next/swc for various architectures (darwin, linux, win32) also reflect this update.
Developers already using Next.js 14.2.20 can upgrade to 14.2.21 with confidence, expecting a smoother development experience and potentially benefiting from subtle performance enhancements due to the updated SWC compiler. The updated version contains 30020 more bytes (86414084-86384364). This is primarily a maintenance release; the core API and features remain consistent. The releaseDate indicates that 14.2.21 was released more recently in December 2024, making it the preferred choice for new projects and existing projects seeking the latest improvements.
All the vulnerabilities related to the version 14.2.21 of the package
Next.js Race Condition to Cache Poisoning
Summary
We received a responsible disclosure from Allam Rachid (zhero) for a low-severity race-condition vulnerability in Next.js. This issue only affects the Pages Router under certain misconfigurations, causing normal endpoints to serve pageProps
data instead of standard HTML.
Credit
Thank you to Allam Rachid (zhero) for the responsible disclosure. This research was rewarded as part of our bug bounty program.
Authorization Bypass in Next.js Middleware
It is possible to bypass authorization checks within a Next.js application, if the authorization check occurs in middleware.
15.2.3
14.2.25
13.5.9
12.3.5
Note: Next.js deployments hosted on Vercel are automatically protected against this vulnerability.
If patching to a safe version is infeasible, it is recommend that you prevent external user requests which contain the x-middleware-subrequest
header from reaching your Next.js application.
Information exposure in Next.js dev server due to lack of origin verification
A low-severity vulnerability in Next.js has been fixed in version 15.2.2. This issue may have allowed limited source code exposure when the dev server was running with the App Router enabled. The vulnerability only affects local development environments and requires the user to visit a malicious webpage while npm run dev
is active.
Because the mitigation is potentially a breaking change for some development setups, to opt-in to the fix, you must configure allowedDevOrigins
in your next config after upgrading to a patched version. Learn more.
Learn more: https://vercel.com/changelog/cve-2025-48068
Thanks to sapphi-red and Radman Siddiki for responsibly disclosing this issue.
Next.js Affected by Cache Key Confusion for Image Optimization API Routes
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
Next.js Content Injection Vulnerability for Image Optimization
A vulnerability in Next.js Image Optimization has been fixed in v15.4.5 and v14.2.31. The issue allowed attacker-controlled external image sources to trigger file downloads with arbitrary content and filenames under specific configurations. This behavior could be abused for phishing or malicious file delivery.
All users relying on images.domains
or images.remotePatterns
are encouraged to upgrade and verify that external image sources are strictly validated.
More details at Vercel Changelog
Next.js Improper Middleware Redirect Handling Leads to SSRF
A vulnerability in Next.js Middleware has been fixed in v14.2.32 and v15.4.7. The issue occurred when request headers were directly passed into NextResponse.next()
. In self-hosted applications, this could allow Server-Side Request Forgery (SSRF) if certain sensitive headers from the incoming request were reflected back into the response.
All users implementing custom middleware logic in self-hosted environments are strongly encouraged to upgrade and verify correct usage of the next()
function.
More details at Vercel Changelog