/

CVE-2026-10108

Severity:

HIGH RISK

(7.5)

Path Traversal in xiaomusic {file_path} Endpoint

CVE-2026-10108

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read

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

xiaomusic v0.5.7 exposes an unauthenticated path traversal flaw in the GET /music/{file_path:path} endpoint, caused by an incomplete path prefix check that omits a trailing separator.

By crafting traversal sequences and exploiting directories whose names share the configured music_path prefix, an attacker can bypass the intended restriction and read arbitrary files outside the music directory.

Affected context

This vulnerability appears in xiaomusic instances that serve media files via the /music/{file_path:path} HTTP endpoint and use a simple prefix-based comparison to constrain file access to a configured music directory.

It arises when the code checks that the resolved path starts with music_path but does not ensure a directory boundary (for example, missing a trailing slash or separator), allowing sibling directories sharing the same prefix to be treated as valid.

Deployments that expose this endpoint over a network without additional authentication or reverse proxy filtering are particularly exposed.

Exploit preconditions

  • Attack surface: Public or internal HTTP interface exposing GET /music/{file_path:path}
  • Required access: No authentication required; any network client that can issue HTTP requests can attempt exploitation
  • Trigger point: File retrieval logic that joins user-controlled file_path with the base music_path and performs an incomplete prefix check without enforcing directory boundaries
  • Why exploitation is possible: The path validation relies solely on string prefix matching without normalizing, canonicalizing, and strictly re-validating the resulting path, enabling traversal sequences to escape the intended directory and reach sibling paths.

Why this happens

The core issue is a classic path traversal condition where user-supplied path segments are insufficiently constrained before being used in filesystem access.

Instead of resolving the requested file path to its canonical form and verifying that it resides strictly within the configured music directory, the implementation performs a simple string prefix check that does not account for trailing separators or directory boundaries.

This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where a resource access control intends to restrict file reads but uses fragile string-based logic allowing crafted paths to reference unintended locations.

Potential impact

  • Reading sensitive configuration files that may contain credentials or tokens
  • Accessing application logs that could reveal internal paths, queries, or user-related information
  • Exposing private user data stored on the same host, depending on file system layout and permissions
  • Gathering information useful for further attacks, such as identifying software versions, directory structures, or other services

General mitigation guidance

Effective mitigation typically focuses on enforcing robust filesystem boundaries and minimizing trust in user-supplied paths.

Common defensive patterns include:

  • Resolving requested paths to canonical/absolute paths and verifying they remain strictly under the intended base directory using filesystem-aware checks rather than string prefix comparisons.
  • Rejecting any request containing traversal sequences (such as parent directory references) after normalization, or mapping only whitelisted logical identifiers to physical paths.
  • Serving media files through higher-level abstractions (e.g., IDs, database references, or content hashes) instead of exposing raw filesystem paths.
  • Running the file-serving component under an account with least-privilege access limited to the intended media directory, reducing the impact of any path validation failures.

How teams detect issues like this

Detection often combines code-level and operational approaches:

  • Static analysis: Configure rules to flag direct concatenation of user-provided path segments with filesystem paths, as well as naive prefix or substring checks used for directory confinement.
  • Code review: Look for implementations that rely on startswith-like checks to enforce directory boundaries and confirm that path normalization and boundary checks are performed using filesystem APIs.
  • Security testing: Incorporate automated and manual tests that attempt path traversal payloads against file-serving endpoints, monitoring for unexpected file disclosures.
  • Logging and monitoring: Enable detailed access logging for file endpoints, and alert on unusual patterns such as repeated use of traversal sequences or requests targeting unexpected directories.

Sources

SourceLink
github.comgithub.com/hanxi/xiaomusic/commit/88404da7a283f2c0a796a4cd16bbb6e6aa1f4722
github.comgithub.com/hanxi/xiaomusic/issues/890
github.comgithub.com/hanxi/xiaomusic/pull/891
vulncheck.comvulncheck.com/advisories/xiaomusic-path-traversal-via-get-music-endpoint

Frequently asked

questions

Yes. Any client that can reach the /music/{file_path:path} endpoint over the network can attempt to exploit the path traversal, without needing authentication, as long as the endpoint is exposed.

The attacker only needs HTTP access to the vulnerable endpoint; no prior login or local filesystem access is required. The practical impact will depend on which files the service's operating system user can read.

The safest pattern is to normalize and canonicalize the requested path, verify it remains under the configured base directory using filesystem-aware checks, and avoid direct exposure of arbitrary path segments by mapping logical identifiers to files. Additionally, ensure directory boundaries are enforced rather than relying on simple string prefix matching.

Design file-serving logic to treat all path input as untrusted, use established path-joining and canonicalization utilities, enforce strict base-directory constraints, and include path traversal tests in automated security testing. Combining these with least-privilege filesystem permissions greatly reduces the risk of future traversal flaws.

Find out what's already
exploitable in your codebase.