/

CVE-2026-49339

Severity:

HIGH RISK

(7.1)

Path Traversal IDOR (CWE-22) in Gonic Playlists

CVE-2026-49339

Deferred

Vulnerability type

Category:

Path Traversal / Insecure Direct Object Reference

CWE:

CWE-22, CWE-639

Impact:

Unauthorized Data Access and Filesystem Probing

Severity:

HIGH RISK

(7.1)

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

Gonic's playlist handling contains a path traversal and insecure direct object reference flaw that allows authenticated users to bypass an ownership check derived from an attacker-controlled playlist ID.

Under typical multi-user Subsonic deployments, any logged-in user can access or delete other users' playlists and probe arbitrary filesystem paths for existence or readability.

Affected context

The issue affects Gonic instances exposing the Subsonic-compatible API where:

  • Playlists are stored on disk and referenced by an ID derived from path segments
  • The application infers ownership from playlist.UserID, derived from the first user-controllable path segment in the playlist ID
  • No strict path containment or canonicalization is enforced on resolved playlist file paths
  • Multiple authenticated users share the same Gonic instance for music streaming and playlist management

In these conditions, the trust boundary around playlist ownership and filesystem exposure becomes weak and can be bypassed by crafted ID values.

Exploit preconditions

  • Attack surface: Subsonic API endpoints that operate on playlists (e.g., read, delete, or manipulate playlists).
  • Required access: Any valid authenticated Subsonic user account on the affected Gonic instance.
  • Trigger point: Supplying a crafted id parameter that manipulates the first path segment and/or introduces traversal elements when calling playlist-related endpoints.
  • Why exploitation is possible: The server derives playlist.UserID directly from the attacker-controlled playlist ID and resolves file paths without robust path containment, allowing an attacker to:
  • Impersonate another user in ownership checks, and
  • Traverse or probe filesystem paths outside the intended playlist directory.

Why this happens

The vulnerability stems from conflating user-controlled identifiers with trusted authorization and filesystem boundaries.

Gonic uses the first path segment of the playlist ID, supplied by the client, to populate playlist.UserID and drive ownership checks, while also resolving this ID into a file path without ensuring it remains within an allowed directory.

This maps to:

  • CWE-22 (Improper Limitation of a Pathname to a Restricted Directory): The application fails to enforce strict path canonicalization and containment, allowing traversal-based probing of arbitrary paths.
  • CWE-639 (Authorization Bypass Through User-Controlled Key): The authorization decision (playlist ownership) relies on an identifier that an attacker can fully control and manipulate.

Conceptually, the bug arises from using untrusted input both as an authorization token and as a filesystem locator without independent verification or normalization.

Potential impact

  • Any authenticated user may read other users' playlists, exposing listening habits and curated content.
  • Any authenticated user may delete or tamper with other users' playlists, causing loss or alteration of user data.
  • Attackers can probe arbitrary file paths on the host system for existence and sometimes readability, aiding reconnaissance.
  • Information gleaned from filesystem probing can facilitate further attacks, such as identifying configuration files or sensitive directories.

General mitigation guidance

Effective mitigation focuses on decoupling user identity from user-controlled identifiers and enforcing strict filesystem constraints:

  • Harden path handling:
  • Resolve playlist IDs to canonical, absolute paths.
  • Enforce that all playlist files reside under a single, configured base directory.
  • Reject any ID that yields a path outside the allowed directory (e.g., after cleaning and resolving .. segments).
  • Use server-trusted identifiers for authorization:
  • Store ownership metadata in a backend data store keyed by internal, non-guessable IDs.
  • Derive UserID from the authenticated session or token, not from request parameters or path segments.
  • Perform authorization checks using server-side mappings, never trusting client-supplied IDs for access control.
  • Constrain filesystem exposure:
  • Limit the directories that API operations can touch to known-safe locations.
  • Avoid exposing low-level filesystem errors that reveal path existence; use generic error messages instead.
  • Apply least privilege and defense in depth:
  • Run the service under an account with minimal filesystem permissions needed for normal operation.
  • Segregate user data from system and configuration directories to reduce the impact of path probing.

How teams detect issues like this

Organizations can detect similar flaws by combining code-centric and operational approaches:

  • Static analysis and linters:
  • Flag any use of user-controlled input in filesystem operations (open, os.File, os.Stat, path join/resolve helpers) without explicit normalization and containment checks.
  • Detect patterns where authorization decisions depend on request parameters such as id, user, or path segments rather than authenticated session context.
  • Code review practices:
  • Explicitly trace how resource IDs (playlist IDs, file paths) are constructed and validated before access.
  • Review all authorization logic to ensure it is based on server-trusted user identity and object ownership metadata, not on client-supplied keys.
  • Check that error handling for I/O operations does not leak information about the underlying filesystem structure.
  • Automated testing and fuzzing:
  • Introduce tests that attempt to access cross-user resources via manipulated IDs and relative path segments.
  • Use API fuzzers or security testing tools to inject traversal payloads (../, %2e%2e/, nested paths) into parameters that influence file access.
  • Runtime monitoring:
  • Log playlist access patterns including authenticated user ID and target resource ID.
  • Alert on suspicious behavior such as a single user attempting to access many distinct playlist paths or unusual directory patterns.

Sources

SourceLink
github.comgithub.com/sentriz/gonic/commit/0824bed88f6bbc490ba28bf09d28e5dfeb07b445
github.comgithub.com/sentriz/gonic/commit/6dd71e6
github.comgithub.com/sentriz/gonic/security/advisories/GHSA-2fp4-5v5c-4448

Frequently asked

questions

Yes, if a Gonic instance exposes the Subsonic API to the internet, any remote user with valid credentials can exploit the issue by sending crafted playlist-related requests. The vulnerability itself is not exploitable by unauthenticated users.

The attacker needs only a standard authenticated Subsonic user account on the affected Gonic server. No administrative privileges are required; ordinary users can craft playlist IDs to bypass ownership checks and probe paths.

The robust fix is to separate trust concerns: use the authenticated user identity from the session or token as the sole source of UserID, store playlist ownership in server-managed metadata, and resolve playlist file paths through canonicalization and strict directory containment checks that reject any traversal or out-of-bounds access.

Future designs should avoid using client-supplied identifiers directly for authorization or filesystem access. Instead, apply defense-in-depth: normalize and constrain all paths to whitelisted directories, use internal opaque IDs for resources, consistently base authorization on server-trusted identity, and enforce these patterns via code review guidelines and automated static analysis rules.

Find out what's already
exploitable in your codebase.