PortGate

Advisories · Node.js & Next.js

CVE-2025-29927 Critical CVSS 9.1 Actively exploited

Next.js middleware authorization bypass

Disclosed 2025 · Last reviewed 2 Dec 2026

A crafted request header could skip Next.js middleware, so routes that trusted middleware for authorization were exposed on self-hosted apps.

What happened

Next.js used an internal header to mark a request as already processed by middleware. An incoming request that carried that header could pass middleware checks.

Affected and patched versions

Affected
Self-hosted Next.js 11.1.4–12.3.4, 13.0.0–13.5.8, 14.0.0–14.2.24, and 15.0.0–15.2.2 when middleware is the authorization boundary.
Patched
12.3.5, 13.5.9, 14.2.25, and 15.2.3.

How to check your server

Check

node -p "require('./node_modules/next/package.json').version"

How to fix and harden

  1. Run the version command in the application directory.
  2. If the installed major is 15, upgrade to 15.2.3 or later. Use 14.2.25, 13.5.9, or 12.3.5 for those majors.
  3. Do not rely on middleware as the only authorization check. Enforce the same rule in the route handler.
  4. Redeploy and confirm the running version matches the patched release.

Fix

npm install [email protected]

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON