/

CVE-2026-30976

Severity:

HIGH RISK

(8.6)

Path Traversal in Sonarr File Serving API on Windows

CVE-2026-30976

Analyzed

Vulnerability type

Category:

Path Traversal / Directory Traversal

CWE:

CWE-22

Impact:

Unauthenticated Arbitrary File Read on Windows Hosts

Severity:

HIGH RISK

(8.6)

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 Sonarr's Windows file serving API allows unauthenticated remote attackers to read arbitrary files accessible to the Sonarr process.

When exposed beyond a trusted network, this can leak configuration files, API keys, database credentials, and other sensitive data from the host system.

Affected context

The vulnerability occurs in Sonarr deployments running on Windows where the HTTP API is reachable by untrusted clients.

The file-serving endpoint fails to enforce proper directory constraints, allowing requests to escape the intended content directory and access other files on the same drive that the Sonarr process can read.

This behavior does not affect macOS or Linux builds, and impact is constrained by the Sonarr process's file system permissions.

Exploit preconditions

  • Attack surface: Sonarr's HTTP API exposed over the network (e.g., via port forwarding, reverse proxy, or direct WAN exposure).
  • Required access: No authentication required; an attacker only needs network connectivity to the Sonarr instance.
  • Trigger point: Invocation of the file-serving API with crafted path parameters that reference locations outside the intended directory.
  • Why exploitation is possible: The server-side path handling logic does not reliably normalize and validate requested paths against an allowed root, enabling directory traversal to arbitrary readable files on the same drive.

Why this happens

This issue stems from insufficient validation and normalization of file paths derived from user-controlled input before accessing the filesystem.

The application intends to serve files from a specific directory but does not robustly enforce that the resolved path remains within that directory after processing user input.

This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where an attacker can use traversal sequences or alternate path representations to escape the intended root and access arbitrary files readable by the application.

Potential impact

  • Disclosure of Sonarr configuration files, including API keys, database credentials, and integration secrets.
  • Exposure of Windows system files that may reveal environment details, installed software, and OS configuration.
  • Access to any user-readable files on the same drive as the Sonarr instance, potentially including documents, scripts, and logs.
  • Facilitation of further compromise by providing information usable in credential stuffing, lateral movement, or targeted exploitation of other services.

General mitigation guidance

Effective mitigation focuses on both code-level path handling and deployment hardening:

  • Implement strict path canonicalization and enforce that all file requests are resolved relative to a fixed, well-defined root directory.
  • Reject any request where the normalized path falls outside the allowed content directory, regardless of how the input was encoded or structured.
  • Avoid directly concatenating user-supplied path fragments with filesystem paths; use safe path-joining utilities that operate on canonicalized components.
  • Limit the Sonarr process's filesystem permissions to the minimal set of directories it truly needs, reducing the impact of any directory traversal.
  • Prefer binding the service to trusted networks only, and place it behind VPNs or zero-trust access layers rather than exposing it directly to the public internet.

How teams detect issues like this

Detection typically combines code-centric and operational approaches:

  • Static analysis: Flag uses of user-controlled path parameters passed into file APIs (e.g., open/read/stream) without prior normalization and root-directory checks; identify suspicious combinations of raw request parameters and filesystem calls.
  • Code review: Examine file-serving handlers for:
  • Direct concatenation of request path components into filesystem paths.
  • Missing checks that the resolved path starts with the intended base directory.
  • Inconsistent treatment of path separators, URL-encoded sequences, or drive letters on Windows.
  • Runtime monitoring: Inspect HTTP access logs for patterns such as ../, encoded traversal (%2e%2e%2f), or access to unexpected file types and locations.
  • Policy enforcement: Integrate secure-coding guidelines and automated checks into CI pipelines to prevent introduction of new path traversal patterns in file or media APIs.

Sources

SourceLink
github.comgithub.com/Sonarr/Sonarr/releases/tag/v4.0.17.2950
github.comgithub.com/Sonarr/Sonarr/releases/tag/v4.0.17.2952
github.comgithub.com/Sonarr/Sonarr/security/advisories/GHSA-h393-v5hm-6h8f

Frequently asked

questions

Yes, if Sonarr is reachable from the internet or any untrusted network segment, an unauthenticated attacker can exploit the path traversal to read arbitrary files accessible to the process.

The attacker only needs network access to the Sonarr HTTP interface; no valid credentials or prior foothold on the host are required to attempt exploitation.

Apply strict canonicalization of any requested file paths and enforce that the final resolved path remains within a predefined root directory, rejecting any request that escapes this boundary. Combine this with least-privilege filesystem permissions for the service account.

Design file-serving features with explicit resource mapping (IDs or whitelisted locations) instead of raw paths, centralize path validation utilities, mandate root-directory checks in code review, and employ static analysis rules that flag direct use of user-supplied paths in file system operations.

Find out what's already
exploitable in your codebase.