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



GHSA-8F24-V5VV-GM5J
5.3

GHSA-8f24-v5vv-gm5j: Open Redirect in next-intl Middleware via URL Parsing Discrepancy

Alon Barad
Alon Barad
Software Engineer

Apr 11, 2026·5 min read·4 visits

PoC Available

Executive Summary (TL;DR)

Unsanitized ASCII control characters in next-intl middleware paths allow unauthenticated attackers to execute open redirects via protocol-relative URLs.

An open redirect vulnerability exists in the next-intl middleware for Next.js applications prior to version 4.9.1. The sanitization logic fails to account for WHATWG URL Specification rules regarding ASCII control characters, allowing attackers to craft malicious links that bypass validation and execute protocol-relative redirects to arbitrary external domains.

Vulnerability Overview

The next-intl library provides internationalization capabilities for Next.js applications. It utilizes middleware to manage locale-based routing, handling user navigation across different language variants. This middleware normalizes URLs, manages redirects, and ensures requests are correctly prefixed with the appropriate locale.

Versions of next-intl prior to 4.9.1 contain an open redirect vulnerability (CWE-601) within the middleware routing logic. The flaw allows an unauthenticated remote attacker to craft specific URIs that redirect users to arbitrary external domains. The vulnerability stems from incomplete sanitization of URL paths containing specific ASCII control characters.

The vulnerability is currently tracked under the GitHub Security Advisory GHSA-8f24-v5vv-gm5j. While open redirects are generally classified as moderate severity, they serve as a critical enabler for targeted phishing campaigns and OAuth token leakage. Security teams should prioritize patching applications utilizing the vulnerable middleware component.

Root Cause Analysis

The vulnerability exists within the sanitizePathname function located in packages/next-intl/src/middleware/utils.tsx. This function normalizes incoming request paths to prevent malicious redirects, specifically attempting to neutralize protocol-relative URLs that begin with double slashes (//).

Prior to the patch, the sanitization logic performed only two operations: encoding backslashes (\) as %5C and collapsing multiple consecutive slashes (//+) into a single slash (/). This implementation failed to account for the WHATWG URL Specification, which governs how modern browsers parse and construct URLs.

The WHATWG specification mandates that certain ASCII control characters—specifically TAB (U+0009), LF (U+000A), and CR (U+000D)—are silently stripped during URL parsing. When a user requests a path containing these characters, the middleware preserves them, but the client-side browser subsequently removes them when resolving the redirect target. This discrepancy between server-side sanitization and client-side parsing creates the conditions for the open redirect.

Code Analysis

The patch introduces a critical string replacement operation within the sanitizePathname function. The original implementation missed the removal of ASCII control characters, allowing them to pass through the middleware's normalization process intact.

// Vulnerable Implementation
export function sanitizePathname(pathname: string) {
  return pathname
    .replace(/\\/g, '%5C')
    .replace(/\/+/g, '/');
}

The updated code, introduced in commit 1c80b668aa6d853f470319eec10a3f61e78a70e6, implements an explicit removal of TAB, LF, and CR characters. This replacement occurs immediately after backslash encoding and before slash collapsing.

// Patched Implementation
export function sanitizePathname(pathname: string) {
  return pathname
    .replace(/\\/g, '%5C')
    .replace(/[\t\n\r]/g, '') // Strips TAB, LF, CR
    .replace(/\/+/g, '/');
}

By stripping these characters on the server side, the middleware effectively aligns its normalization logic with the WHATWG specification. If an attacker attempts to inject a TAB character between slashes, the server now strips the TAB and subsequently collapses the resulting double slash into a single slash, neutralizing the protocol-relative URL attack vector.

Exploitation and Attack Methodology

Exploitation requires the attacker to construct a URL targeting a Next.js application running a vulnerable version of next-intl. The attacker embeds an encoded control character, such as %09 (TAB), strategically within the URL path. A typical payload follows the structure http://<victim-domain>/<locale>/%09/attacker.com.

When the victim clicks the crafted link, the next-intl middleware processes the request. It decodes the URL-encoded characters, resulting in a path structured as /en/[TAB]/attacker.com. The middleware then attempts to normalize this path by removing the locale prefix and issues an HTTP redirect instruction to the client.

Upon receiving the redirect response, the victim's browser processes the target URL /[TAB]/attacker.com. Following the WHATWG specification, the browser silently drops the TAB character. The resulting string //attacker.com is interpreted as a protocol-relative URL, instructing the browser to initiate a request to the external domain attacker.com.

Impact Assessment

The primary impact of this vulnerability is the facilitation of sophisticated phishing campaigns. Attackers leverage the reputation and trust of the vulnerable domain to construct convincing links. When victims click these links, they are transparently redirected to an attacker-controlled site designed to harvest credentials or distribute malware.

Beyond basic phishing, open redirects often serve as a critical stepping stone in complex attack chains. If the vulnerable application implements OAuth or similar authentication flows, attackers can utilize the open redirect to exfiltrate authorization codes or access tokens by manipulating callback URIs.

The vulnerability is classified as moderate severity, reflecting the requirement for user interaction. The execution relies exclusively on social engineering to prompt a victim to initiate the malicious request. However, the lack of authentication requirements and the high success rate of domain-trusted phishing links warrant immediate remediation.

Remediation and Mitigation

The primary remediation strategy requires upgrading the next-intl package to version 4.9.1 or later. This update contains the necessary logic to strip ASCII control characters during path sanitization. Development teams should execute npm install next-intl@latest to apply the fix.

Organizations unable to deploy the patch immediately can mitigate the vulnerability using Web Application Firewall (WAF) rules. Administrators should configure the WAF to intercept and drop HTTP requests containing encoded control characters (%09, %0A, %0D) within the request path.

Security engineers should also review existing application routing logic for similar URL parsing discrepancies. The misalignment between server-side path normalization and client-side URL parsing is a common source of bypasses in routing middleware. Relying exclusively on regex-based string replacements often leaves edge cases exposed to manipulation.

Official Patches

amannnOfficial patch commit modifying sanitizePathname
amannnPull request resolving the vulnerability
amannnRelease notes for version 4.9.1

Fix Analysis (1)

Technical Appendix

CVSS Score
5.3/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N

Affected Systems

Next.js applications utilizing the next-intl middleware for internationalized routing.

Affected Versions Detail

Product
Affected Versions
Fixed Version
next-intl
amannn
< 4.9.14.9.1
AttributeDetail
CWE IDCWE-601
Attack VectorNetwork
CVSS v4.0 ScoreModerate
Exploit StatusProof-of-Concept
ImpactOpen Redirect / Phishing Enabler
AuthenticationNone Required

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1566.002Phishing: Spearphishing Link
Initial Access
CWE-601
URL Redirection to Untrusted Site ('Open Redirect')

A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.

Known Exploits & Detection

GitHub AdvisoryDetails regarding the URL manipulation using URL-encoded tab characters (%09).

Vulnerability Timeline

Fix commit authored and merged into main
2026-04-10
Official release of patched version 4.9.1
2026-04-10

References & Sources

  • [1]GitHub Advisory: GHSA-8f24-v5vv-gm5j
  • [2]Fix Commit: 1c80b668aa6d853f470319eec10a3f61e78a70e6
  • [3]Pull Request #2304
  • [4]Release v4.9.1

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.