/

CVE-2026-49340

Severity:

HIGH RISK

(8.1)

Path Traversal (CWE-22) in Gonic Playlist Handling

CVE-2026-49340

Deferred

Vulnerability type

Category:

Path Traversal / Arbitrary File Write

CWE:

CWE-22, CWE-697, CWE-732

Impact:

Arbitrary File Write on Server Filesystem

Severity:

HIGH RISK

(8.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

A logic error in Gonic's playlist handling allows any authenticated Subsonic user to write playlist M3U data to arbitrary absolute filesystem paths on the server.

When exploited, attackers can create world-writable directories and files outside the intended storage area, increasing the risk of data tampering, privilege abuse, or further compromise.

Affected context

This vulnerability occurs in Gonic deployments that expose the Subsonic-compatible API and allow users to create or update playlists.

The issue lies in the ServeCreateOrUpdatePlaylist logic combined with a storage layer (Store.Write) that does not enforce path containment or normalization.

In such contexts, an authenticated but non-admin user can influence the filesystem path used for playlist storage, and the server will accept absolute paths and create intermediate directories with permissive 0o777 permissions.

The risk is higher when the Gonic process runs with broad filesystem privileges or on shared hosts where other services trust local filesystem integrity.

Exploit preconditions

  • Attack surface: HTTP API (Subsonic-compatible endpoints) exposed by the Gonic server.
  • Required access: Any authenticated Subsonic user account; administrative privileges are not required.
  • Trigger point: Invocation of the playlist creation or update endpoint that ultimately calls ServeCreateOrUpdatePlaylist, which delegates to Store.Write.
  • Why exploitation is possible:
  • A guard clause intended to constrain paths is unreachable and therefore ineffective (CWE-697: Incorrect Comparison or Logic).
  • The storage implementation does not validate that target paths are within an expected base directory nor restrict absolute paths (CWE-22: Path Traversal).
  • Directory creation uses overly permissive mode 0o777, granting full access to all users (CWE-732: Incorrect Permission Assignment).

Why this happens

The core issue is a missing and ineffective path containment check combined with lenient filesystem operations.

In ServeCreateOrUpdatePlaylist, logic intended to prevent unsafe paths is structured such that the guard clause is never reached, leaving path inputs effectively unvalidated.

Store.Write then accepts absolute paths and performs file and directory creation without verifying that the final target resides under a designated storage root, nor normalizing or sanitizing the path components.

Additionally, new directories are created with 0o777 permissions, which grants read, write, and execute rights to all users, compounding the damage if arbitrary paths can be chosen.

This pattern maps primarily to CWE-22: Path Traversal, with contributing issues from CWE-697: Incorrect Comparison or Logic and CWE-732: Incorrect Permission Assignment for Critical Resource.

Potential impact

  • Attackers can write or overwrite files at attacker-chosen absolute paths within the permissions of the Gonic process.
  • Creation of world-writable (0o777) directories that other local users or processes can abuse.
  • Potential tampering with application configuration, logs, or data files, leading to denial of service or inconsistent behavior.
  • Facilitation of further compromise if file writes impact scripts, cron jobs, or other components that are later executed or parsed.
  • Increased lateral movement opportunities on multi-tenant systems where other services rely on filesystem integrity.

General mitigation guidance

Effective mitigation focuses on strict path handling, minimizing filesystem privileges, and robust permission policies:

  • Enforce a fixed storage root for playlists and normalize all user-influenced paths against this root; reject absolute paths and any traversal (..) components.
  • Centralize path validation logic so that all file writes pass through a function that enforces containment and canonicalization before touching the filesystem.
  • Use least privilege for the Gonic process: run under a dedicated, unprivileged account with access only to required directories.
  • Avoid world-writable directories; apply conservative directory modes by default and restrict write access to the service account whenever possible.
  • Implement defense-in-depth controls such as mounting storage with restricted execute permissions where feasible to reduce the impact of malicious files.
  • Adopt secure-by-default configuration where playlist paths are not user-configurable beyond benign, validated identifiers.

How teams detect issues like this

To detect and monitor for this class of issue:

  • Apply static analysis or linters configured to flag direct use of filesystem APIs with unvalidated or concatenated user input, especially where absolute paths are accepted.
  • During code review, look for:
  • File or directory creation based on request parameters or externally supplied identifiers.
  • Absence of path normalization and containment checks against a known base directory.
  • Overly permissive permission modes such as 0o777 on created paths.
  • Use application-level logging to record playlist operations, including resolved filesystem paths, and monitor for unexpected locations outside the intended storage tree.
  • Employ host-based intrusion detection or file integrity monitoring on sensitive directories to spot unexpected M3U files or newly created world-writable directories.
  • Integrate security checks into CI/CD pipelines that enforce policies around path handling and permissions (e.g., custom rules in SAST tools or policy-as-code frameworks).

Sources

SourceLink
github.comgithub.com/sentriz/gonic/security/advisories/GHSA-4gxv-p5g5-j7w7

Frequently asked

questions

The issue is exploitable by any authenticated Subsonic user of the Gonic server; no administrative role is required.

However, the actual impact depends on the filesystem permissions of the Gonic process and the system's layout.

An attacker needs network access to the Gonic API and valid credentials for any user account.

There is no need for shell access or direct filesystem access to the server.

Implement strict path containment by resolving all user-influenced paths relative to a fixed base directory, rejecting absolute or traversing paths, and centralize this logic so all file writes are mediated.

At the same time, ensure directory and file permissions are set to the minimum required for the service account.

Treat all path components derived from requests as untrusted data, enforce normalization and containment, and avoid exposing raw filesystem paths to clients.

Combine this with thorough code review focused on filesystem operations, automated checks for dangerous permission modes, and least-privilege deployment practices.

Find out what's already
exploitable in your codebase.