Add Next.js middleware authorization bypass scanner (CVE-2025-29927) #21566
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.66) × (1 − Review Confidence (0.58)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.66 · 369 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.354
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.066
Real PR Conversation Timeline
1 comments
"Review active on #21566"
general
weight: 0.35
kenlacroix
Summary
Adds
auxiliary/scanner/http/nextjs_middleware_auth_bypass, a detection module forCVE-2025-29927 (CVSS 9.1) — an
authorization bypass in self-hosted Next.js applications.
Vulnerability
Next.js tags its own internal subrequests with the
x-middleware-subrequestheaderand skips middleware when it sees it. The header is trusted without verifying it
originated internally, so an external client that supplies it makes Next.js skip
middleware execution entirely — bypassing any authentication, authorization, or
redirects implemented in
middleware.ts. The header value is the middleware modulename; on Next.js 13.2+ it must be repeated five times to satisfy the internal
recursion-depth check. Affected self-hosted versions:
< 12.3.5,< 13.5.9,< 14.2.25,< 15.2.3. (Vercel/Netlify-hosted apps are not affected — the platformsstrip the header.)
What the module does
This is a detection module (the impact is app-specific). It performs a
differential check against a user-supplied, normally middleware-gated path
(
TARGETURI):1. A baseline request that is expected to be gated (a redirect to login, or 401/403).
2. The same request with a crafted
x-middleware-subrequestheader (it iterates theknown per-version payloads).
If the gate disappears — the protected resource is served, or the middleware login
redirect is gone — the target is reported vulnerable. It only reports; it does not
act on the bypassed response.
Verification
Tested against minimal self-hosted Next.js apps (App Router, a
middleware.tsthatredirects
/dashboardto/login) at a vulnerable and a patched version:Documentation with the full Docker lab setup and scenarios is included at
documentation/modules/auxiliary/scanner/http/nextjs_middleware_auth_bypass.md.Verification Steps
1. Start a vulnerable self-hosted Next.js app with a middleware-gated route (see docs)
2.
use auxiliary/scanner/http/nextjs_middleware_auth_bypass3.
set RHOSTS <target>4.
set TARGETURI <a middleware-gated path>5.
run— the module reports the bypass when the gate is removed under the header