Next.js WAF Mitigations, React CVE Patching, and Middleware Bypass Rules
How Cloudflare WAF rules complement Next.js and React patches for CVEs, middleware bypass, image SSRF, and when WAF alone is not enough.
This page summarises Cloudflare documentation on protecting Next.js and React Server Components applications behind the Cloudflare WAF: which managed rules ship by default, which CVEs need framework upgrades, and how OpenNext and related adapters fit in. It is for operators who see a React or Next.js security advisory and need to know whether enabling WAF rules is enough or patching is mandatory.
React and Next.js CVE disclosures: patch first, WAF second
Section titled “React and Next.js CVE disclosures: patch first, WAF second”When React and Vercel publish advisories for React Server Components and Next.js, impact often spans denial of service, middleware bypass, SSRF, XSS, and cache poisoning—not a single fix in the dashboard.
Multiple security vulnerabilities were disclosed by the React team and Vercel affecting React Server Components and Next.js. These include denial of service, middleware and proxy bypass, server-side request forgery, cross-site scripting, and cache poisoning issues across a range of severity levels.
We strongly recommend updating your application and its dependencies immediately. Patched versions are available for React (react-server-dom-webpack, react-server-dom-parcel, and react-server-dom-turbopack 19.0.6, 19.1.7, and 19.2.6) and Next.js (15.5.16 and 16.2.5).
— Cloudflare, WAF and framework adapter mitigations for React and Next.js vulnerabilities
Cloudflare’s position is explicit: several issues cannot be blocked safely at the WAF, so applications must not rely on edge rules alone.
Several of the disclosed vulnerabilities are not possible to block in WAF. We strongly recommend updating your applications so they are not purely reliant on WAF mitigations.
— Cloudflare, WAF and framework adapter mitigations for React and Next.js vulnerabilities
Customers on Pro, Business, or Enterprise should have Managed Rules enabled; the same post notes that some React DoS rules apply even on the Free Managed Ruleset.
Managed WAF rules for React Server Component denial of service
Section titled “Managed WAF rules for React Server Component denial of service”For prior React Server Component CVEs, Cloudflare reused generic attack-pattern detections. One rule may be Disabled in the ruleset UI while another Blocks by default—verify both rule IDs in your zone.
| Rule description | Rule ID | Default action (per Cloudflare) |
|---|---|---|
| React - DoS - CVE-2025-55184 | 2694f1610c0b471393b21aef102ec699 |
Disabled |
| React - DoS - CVE-2026-23864 | aaede80b4d414dc89c443cea61680354 |
Block |
Cloudflare states that these patterns also cover CVE-2026-23870 / GHSA-8h8q-6873-q5fj (denial of service in Server Components). Additional managed coverage for some high-severity advisories was still under investigation at the time of the WAF changelog entry.
Which advisories WAF can and cannot cover
Section titled “Which advisories WAF can and cannot cover”The summary table in Cloudflare’s React/Next.js post is the practical map from advisory to edge mitigation:
| Severity band | Example issue types | Typical WAF status |
|---|---|---|
| High | Middleware bypass via route parameters, SSRF via WebSocket upgrades | Not possible to enable a global managed rule without breaking apps |
| High | Middleware bypass (i18n, segment-prefetch) | Investigating managed rules; custom rules sometimes possible |
| Moderate | XSS, Image Optimization API DoS, cache poisoning in RSC responses | Often custom WAF rule possible; global managed rule may break behavior |
| Low | RSC cache-busting collisions | Global managed rule not possible safely |
Use this table to decide whether you are waiting for a managed rule announcement in the WAF changelog, writing a custom rule, or shipping a Next.js/React patch only.
CVE-2025-29927: middleware authentication bypass and the x-middleware-subrequest header
Section titled “CVE-2025-29927: middleware authentication bypass and the x-middleware-subrequest header”CVE-2025-29927 is a Next.js authentication bypass tied to middleware handling. Patched releases include Next.js 15.2.4, 14.2.26, 13.5.10, and 12.3.6 (with further middleware fixes noted in Cloudflare’s updates). If you cannot upgrade immediately—especially on older majors—you can use WAF to strip the attack vector at the edge.
We’ve made a WAF (Web Application Firewall) rule available to all sites on Cloudflare to protect against the Next.js authentication bypass vulnerability (CVE-2025-29927) published on March 21st, 2025.
Note: This rule is not enabled by default as it blocked requests across sites for specific authentication middleware.
— Cloudflare, New Managed WAF rule for Next.js CVE-2025-29927
The managed rule blocks external requests that carry the x-middleware-subrequest header, regardless of Next.js version. Cloudflare later made the rule opt-in because legitimate auth middleware (including third-party auth vendors) could fail when the header was blocked.
We have changed this WAF rule to opt-in only, as sites that use auth middleware with third-party auth vendors were observing failing requests.
— Cloudflare, New Managed WAF rule for Next.js CVE-2025-29927
Enable the managed rule for CVE-2025-29927 (Pro plan and above)
Section titled “Enable the managed rule for CVE-2025-29927 (Pro plan and above)”On Pro and higher plans, the CVE-2025-29927 rule is opt-in inside the Cloudflare Managed Ruleset. Rule ID: 34583778093748cc83ff7b38f472013e.
- Open Security → WAF → Managed rules for the zone in the Cloudflare dashboard (steps are documented in New Managed WAF rule for Next.js CVE-2025-29927).
- Edit Cloudflare Managed Ruleset → Browse Rules.
- Search for CVE-2025-29927 or rule ID
34583778093748cc83ff7b38f472013e. - Set Status to Enabled and Action to Block (or Log first to measure impact).
- Save the ruleset.
Custom WAF rule for CVE-2025-29927 on Free plan or tailored blocking
Section titled “Custom WAF rule for CVE-2025-29927 on Free plan or tailored blocking”Free-plan sites—or anyone who wants a dedicated rule—can block the same header with a Custom WAF rule (Create a WAF rule (manual)):
(len(http.request.headers["x-middleware-subrequest"]) > 0)Set the action to block, or log while validating auth flows. This protects Next.js on Workers, Pages, and Next.js origins proxied through Cloudflare.
Next.js image optimization CVEs: file download and cache poisoning
Section titled “Next.js image optimization CVEs: file download and cache poisoning”A separate emergency WAF release addressed critical flaws in Next.js image optimization:
CVE-2025-55173: Arbitrary file download from the server via image optimization.
CVE-2025-57752: Cache poisoning leading to unauthorized data disclosure.
— Cloudflare, WAF Release - 2025-08-29 - Emergency
Cloudflare added Cloudflare Managed Ruleset detections (legacy IDs 100613 and 100616) with Block as the new action. Exploitation could expose sensitive files, leak backend data, and undermine trust—so patching and cache hardening remain primary; WAF adds edge blocking for known patterns.
| Description | Rule ID suffix (as listed) | Legacy Rule ID |
|---|---|---|
| Next.js - Dangerous File Download - CVE-2025-55173 | ...9ff4bfe3 |
100613 |
| Next.js - Information Disclosure - CVE-2025-57752 | ...69b9ea7d |
100616 |
Details appear in WAF Release - 2025-08-29 - Emergency.
OpenNext on Cloudflare: SSRF via /_next/image and platform mitigations
Section titled “OpenNext on Cloudflare: SSRF via /_next/image and platform mitigations”For apps using @opennextjs/cloudflare, an SSRF class issue allowed proxying arbitrary remote content through the victim site’s /_next/image endpoint—for example, attacker content served under the victim hostname (SSRF vulnerability in @opennextjs/cloudflare).
Reported impact includes unrestricted remote URL loading, same-origin policy violations, and phishing or internal exposure risks. Mitigations layered as follows:
- Platform constraint: Cloudflare restricted
/_next/imageloads to images for existing and future deployments on affected adapter versions. - Package fix: Patched adapter
@opennextjs/cloudflare@1.3.0(root fix in PR #727, noted in Workers changelog). - Scaffolding:
create-cloudflare@2.49.3pulls the fixed adapter (changelog).
Cloudflare encourages upgrading to @opennextjs/cloudflare v1.3.0 or later and using Next.js remotePatterns configuration when allow-listing external image URLs (mitigation section).
Framework adapters: Vinext and OpenNext hardening notes
Section titled “Framework adapters: Vinext and OpenNext hardening notes”Cloudflare’s React/Next.js security posts document how alternative runtimes interact with the same CVE set:
- Vinext (Vite-based Next.js API surface): Cloudflare reports the latest Vinext release as not vulnerable to the disclosed CVEs, citing architectural differences (no PPR resume protocol, no Pages Router data-route endpoints, stripping internal headers such as
x-nextjs-data). New projects viavinext initrequire React 19.2.6+ to avoid pairing Vinext with vulnerable React (WAF and framework adapter mitigations). - OpenNext on Cloudflare: The adapter is not described as directly vulnerable to the React DoS CVE, but application Next.js versions must still be patched; the OpenNext team hardened the Cloudflare adapter and updated fixtures to patched versions (same post).
For supported Next.js features on Workers (middleware, RSC, image optimization via Cloudflare Images, and limits such as Node.js in Middleware not yet supported), see OpenNext adapter.
Common mistakes when relying on WAF for Next.js CVEs
Section titled “Common mistakes when relying on WAF for Next.js CVEs”- Treating enabled managed rules as complete protection while running vulnerable Next.js or react-server-dom-* versions.
- Enabling CVE-2025-29927 blocking without a Log period when using third-party auth middleware that may send
x-middleware-subrequest. - Assuming a Free plan has the CVE-2025-29927 managed rule enabled by default—it is opt-in on Pro+; Free sites need a custom header rule.
- Ignoring cache poisoning and middleware bypass advisories marked “custom rule possible” while waiting for a global managed rule that may never ship safely.
- Running older
@opennextjs/cloudflarefor performance reasons without moving past v1.3.0 after the SSRF advisory (performance changelog notes fixes from v1.3.0 onward).
How to check this on your site
Section titled “How to check this on your site”- Confirm application versions: Next.js 15.5.16 / 16.2.5 (or other patched lines from Cloudflare’s advisory) and matching react-server-dom-* packages.
- In the Cloudflare dashboard, open Security → WAF → Managed rules and verify Cloudflare Managed Ruleset is on; review React DoS rules
2694f1610c0b471393b21aef102ec699andaaede80b4d414dc89c443cea61680354per WAF changelog. - If you run Next.js middleware auth and cannot patch yet, enable or log the CVE-2025-29927 rule (
34583778093748cc83ff7b38f472013e) or deploy the customx-middleware-subrequestexpression from CVE-2025-29927 WAF post. - For OpenNext deployments, confirm
@opennextjs/cloudflare≥ 1.3.0 and review WAF events for Next.js image rules from emergency WAF release. - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about so it can be corrected.