Severity:

HIGH RISK

(7.5)

Path Traversal in fast-uri

CVE-2026-6321

Modified

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Path-based access control bypass and unintended resource exposure

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

fast-uri performed percent-decoding of path separators and dot segments before running its dot-segment removal logic in the normalize() and equal() functions, causing encoded slashes and .. components to be treated as real path elements.

When applications rely on these helpers to normalize or compare attacker-controlled URLs for path-based access control, an attacker can craft URLs that appear to stay under an allowed prefix but normalize to a different, potentially sensitive location.

Affected context

This vulnerability appears in applications that:

  • Use fast-uri (versions ≤ 3.1.0) to normalize or compare URLs
  • Make authorization or routing decisions based on a normalized URI path prefix
  • Accept some portion of the URL from untrusted or semi-trusted sources (e.g., user input, request parameters, proxy headers)

The risk is elevated where path-based policies are expected to confine requests to a specific namespace (such as /public/ or /tenant/<id>/) and no additional canonicalization or filesystem checks are applied after using fast-uri.

Exploit preconditions

  • Attack surface: Any HTTP or application endpoint where:
  • A user-controlled URL or path is processed using fast-uri's normalize() or equal() functions
  • The result is used to enforce path-based security, multi-tenant isolation, or routing restrictions
  • Required access: Ability to supply or influence URL path components or query parameters that are passed through fast-uri.
  • Trigger point: Invocation of fast-uri normalization or equality checks on an attacker-crafted URI containing percent-encoded slashes (%2F) and/or dot segments (. / ..) designed to alter the normalized path.
  • Why exploitation is possible: fast-uri decodes percent-encoded path separators and dot segments before performing dot-segment removal, causing different textual inputs to collapse to the same normalized path and allowing encoded parent-directory references to escape the intended path prefix.

Why this happens

The root cause is a URI canonicalization logic flaw aligned with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

Conceptually:

  • fast-uri's normalize() and equal() implementations decode percent-encoded characters in the path, including /, . and ..-related sequences, before applying the dot-segment removal algorithm.
  • Because %2F and similar encodings are treated as real slashes during normalization, encoded segments such as %2e%2e can effectively become .. and participate in directory traversal during canonicalization.
  • As a result, two URIs that look different at the raw-text level (one seemingly confined under a safe prefix, another outside it) can normalize to the same canonical path, undermining logic that assumes normalization prevents traversal.

This pattern reflects a class of bugs where normalization, decoding, and policy enforcement are applied in the wrong order, or inconsistently, allowing crafted inputs to bypass prefix checks and directory constraints.

Potential impact

  • Bypass of path-based access control rules for web endpoints or API routes
  • Unauthorized access to resources outside an intended URL namespace or tenant scope
  • Exposure of sensitive data that was assumed to be protected by path prefix checks
  • Ability to reach internal admin or debug paths by masquerading as requests to allowed locations
  • Confusion in logging, monitoring, and audit trails due to mismatches between apparent and normalized paths

General mitigation guidance

Effective mitigation focuses on correcting URI normalization behavior and hardening path-based policy design:

  • Canonicalization order: Ensure that percent-decoding, dot-segment removal, and any other normalization steps are applied in a consistent, standards-aligned order that does not allow encoded traversal sequences to emerge after security checks.
  • Defensive prefix checks: When implementing prefix-based authorization, compare against fully canonicalized paths that cannot later change meaning (e.g., post-normalization, with redundant segments removed).
  • Additional confinement layers: Where URLs map to filesystem paths or internal routing, combine normalization with:
  • Explicit checks rejecting any .. segments after normalization
  • Directory or namespace whitelisting instead of relying solely on string-prefix checks
  • Least privilege in routing: Avoid granting broad access based solely on a path prefix; associate authorization decisions with explicit resources or identifiers rather than raw path strings.
  • Input trust reduction: Treat all user-supplied URL components as untrusted, even when they appear encoded or normalized, and validate them against strict patterns or resource maps.

How teams detect issues like this

Detection can leverage both code-focused and behavior-focused approaches:

  • Static analysis/code scanning:
  • Identify uses of fast-uri's normalize() and equal() that are directly tied to authorization, tenancy isolation, or path-based routing decisions.
  • Flag patterns where normalized paths are compared using string-prefix checks (e.g., startsWith('/allowed/')) without further validation.
  • Targeted code review:
  • Examine security-sensitive modules (auth middleware, multi-tenant routing, reverse proxies, static file handlers) for reliance on normalized URLs to enforce confinement.
  • Review any logic that maps normalized paths to filesystem locations or internal resource identifiers.
  • Dynamic testing and fuzzing:
  • Construct test cases with percent-encoded slashes and dot segments (e.g., combinations of %2F, %2e, %2e%2f) to see whether requests can escape intended path boundaries.
  • Policy enforcement in CI/CD:
  • Enforce guidelines that discourage raw string-prefix checks on user-controlled paths and require canonicalization and validation helpers with clearly documented semantics.

Automated SAST/DAST tools can assist by flagging high-risk path handling constructs and verifying behavior under crafted encoded paths.

Sources

SourceLink
cna.openjsf.orgcna.openjsf.org/security-advisories.html
github.comgithub.com/fastify/fast-uri/security/advisories/GHSA-q3j6-qgpj-74h6
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19238
access.redhat.comaccess.redhat.com/errata/RHSA-2026:20338
access.redhat.comaccess.redhat.com/errata/RHSA-2026:21338
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24473
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24766
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24866
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24977
access.redhat.comaccess.redhat.com/errata/RHSA-2026:25089
access.redhat.comaccess.redhat.com/errata/RHSA-2026:25123
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26214
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26234
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26416
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26420
access.redhat.comaccess.redhat.com/errata/RHSA-2026:34342
access.redhat.comaccess.redhat.com/errata/RHSA-2026:37385
access.redhat.comaccess.redhat.com/errata/RHSA-2026:42078
access.redhat.comaccess.redhat.com/errata/RHSA-2026:42079
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-6321
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2466582
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-6321.json

Frequently asked

questions

Yes, in typical web or API deployments. If an application exposes endpoints that accept attacker-controlled URLs or path components and use fast-uri to normalize or compare them for security decisions, an external attacker can craft malicious URLs to attempt bypass.

The attacker generally only needs the ability to send HTTP requests or otherwise provide URL/path input processed via fast-uri. No prior authentication is required unless the affected endpoints are themselves restricted.

Use a URI/URL normalization routine that:

  • Applies percent-decoding and dot-segment removal in a well-defined, standards-compliant order
  • Produces a canonical path where traversal sequences are eliminated or rejected
  • Is used consistently wherever path-based decisions are made

On top of that, avoid relying solely on string-prefix checks; validate that the resulting canonical path is within an allowed directory or namespace.

Design path and URL handling with canonicalization and security in mind from the outset:

  • Clearly separate parsing/normalization from authorization logic, and document the guarantees that normalization functions provide.
  • Standardize on vetted library helpers for canonicalization rather than ad hoc string manipulation.
  • Add tests that explicitly cover encoded slashes, ./.. segments, and other tricky inputs for any security-sensitive routing or file-serving code.
Find out what's already
exploitable in your codebase.