/

CVE-2026-49846

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in libks HTTP Request URI Parser

CVE-2026-49846

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-697

Impact:

Unauthorized File Access or Modification

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

A path traversal vulnerability in libks allows specially structured URI paths containing parent-directory segments to bypass internal canonicalization limits. When a vulnerable consumer later combines the URI path with a filesystem path, an attacker may access or manipulate files outside the intended directory.

Affected context

The issue occurs in libks HTTP request parsing when clean_uri() processes a URI whose path contains more segments than its internal canonicalization buffer can hold. In affected consumers, the URI may pass through with embedded .. sequences intact and later be joined with a filesystem path. Risk depends on whether an application exposes the parser to attacker-controlled requests and uses the resulting path for filesystem operations.

Exploit preconditions

  • Attack surface: HTTP or other request-processing interfaces that use libks URI parsing
  • Required access: Ability to submit or influence a URI path
  • Trigger point: URI canonicalization followed by filesystem path construction or access
  • Why exploitation is possible: Excess path segments can cause canonicalization to fail open, preserving traversal sequences that a downstream filesystem operation may interpret

Why this happens

The underlying bug is a bounds-handling and validation failure in URI canonicalization. When the path exceeds the capacity of the internal normalization buffer, the parser does not reject the input or ensure that traversal segments are removed, allowing unsafe path components to remain in the result. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with CWE-697: Incorrect Comparison reflecting the flawed handling or validation logic that permits the unsafe condition.

Potential impact

  • An attacker may read files outside an intended document or resource directory
  • An attacker could overwrite or delete files if downstream operations permit modification
  • Sensitive configuration, credentials, or application data may be exposed
  • Server-side request processing may be redirected toward unintended filesystem resources
  • The vulnerability could contribute to broader application compromise depending on process privileges

General mitigation guidance

Mitigation generally focuses on rejecting malformed or overlong URI paths before filesystem use and ensuring that canonicalization fails closed.

Common defensive patterns include:

  • Enforcing explicit limits on path depth and normalized path length
  • Rejecting unresolved .. components after canonicalization
  • Resolving paths against an approved base directory and verifying containment
  • Using filesystem APIs that operate on constrained directory handles where available
  • Treating request-derived paths as untrusted and avoiding direct concatenation
  • Running services with only the filesystem permissions they require
  • Applying consistent validation in every consumer rather than relying solely on parser behavior

How teams detect issues like this

Detection approaches commonly include:

  • Static analysis for direct concatenation of request-derived URI paths with filesystem paths
  • Code review checks for canonicalization routines that silently return oversized or partially normalized input
  • Tests covering excessive path depth, repeated separators, encoded traversal markers, and unresolved parent-directory segments
  • Runtime logging and alerting for rejected traversal-like requests and unusual path depth
  • Policy enforcement requiring containment checks before filesystem access
  • Automated security review tools that identify path construction using untrusted request components

Sources

SourceLink
github.comgithub.com/signalwire/libks/security/advisories/GHSA-684h-wjm9-2p6j

Frequently asked

questions

It can be remotely exploitable when an HTTP-facing application accepts attacker-controlled URI paths and passes the parsed result to filesystem operations. Exploitability depends on the behavior and exposure of the consuming application.

The attacker generally needs the ability to send requests or otherwise influence a URI processed by the vulnerable parser. Authentication requirements depend on the consumer's access controls.

Ensure overlong or malformed paths are rejected, perform canonicalization that fails closed, and verify that the final resolved path remains within an approved directory before accessing the filesystem.

Treat all request-derived paths as untrusted, avoid string-based path construction, test normalization edge cases, enforce least-privilege service accounts, and apply centralized path-containment policies.

Find out what's already
exploitable in your codebase.