Summary
FileBrowser Quantum's subtitlesHandler endpoint allows user-controlled path and file name parameters to be used directly in filesystem operations without sanitization.
An authenticated user can traverse outside the configured storage root and read arbitrary text files accessible to the server process, becoming risky whenever sensitive configuration or key material is stored on disk.
Affected context
This vulnerability appears in deployments of FileBrowser Quantum where the /api/media/subtitles endpoint is exposed to authenticated users.
It is relevant whenever the application server runs with permissions to read files beyond the intended storage root, such as system configuration, SSH keys, or application secrets.
The issue manifests when user-supplied path and name query parameters are treated as trusted filesystem inputs without normalization or policy enforcement.
Exploit preconditions
- Attack surface: HTTP GET requests to
/api/media/subtitlesvia thesubtitlesHandlerendpoint. - Required access: Any authenticated account, regardless of role or file access permissions within the application.
- Trigger point: Supplying crafted
pathand/ornamequery parameters that include directory traversal sequences (../) or absolute-like paths. - Why exploitation is possible:
- The
pathparameter is passed directly toidx.GetRealPath()without going throughSanitizeUserPath(), allowingparentDirto resolve outside the storage root. - The
nameparameter is joined withparentDirusingfilepath.Join(parentDir, name)without stripping directory components, enabling traversal relative to the attacker-controlledparentDir. - No anchor file or prior knowledge of existing paths is required; the attacker can directly target known system or application files.
Why this happens
The root cause is improper validation and normalization of user-supplied filesystem paths before they are used in file resolution logic.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') and CWE-23: Relative Path Traversal, where input meant to identify resources under a constrained directory is allowed to escape that boundary.
By calling path resolution functions on raw query parameters and combining them with filepath.Join without enforcing a storage-root constraint or stripping traversal sequences, the code creates a general-purpose file locator that attackers can drive using crafted paths.
Potential impact
- An attacker may read sensitive configuration files (e.g., database connection strings, API keys).
- An attacker could access SSH private keys or authorized_keys files readable by the server process.
- JWT signing keys or other cryptographic secrets can be disclosed, enabling token forgery.
- System files such as
/etc/passwdmay be read, aiding in reconnaissance and further attacks. - Application logs and other internal data sources could be exposed, increasing information leakage.
General mitigation guidance
Effective mitigation focuses on strictly constraining filesystem access to an intended storage root and treating all user-supplied paths as untrusted.
Common defensive patterns include:
- Centralizing path resolution through a function that enforces a fixed base directory and rejects any path that resolves outside it.
- Normalizing and canonicalizing incoming paths, then explicitly checking for traversal sequences or directory components that attempt to escape the allowed root.
- Avoiding direct use of user input in
Joinor similar APIs without validation; instead, map logical identifiers to server-side paths. - Separating storage for secrets and configuration from application data directories and running the service with least-privilege filesystem permissions.
- Designing endpoints to accept opaque file IDs or handles rather than raw filesystem paths, reducing the risk surface for traversal.
How teams detect issues like this
Organizations can detect path traversal patterns through:
- Static analysis rules that flag uses of filesystem APIs (
Open,Join,GetRealPath, etc.) with direct user-controlled input and no preceding normalization or root-bound checks. - Code review checklists that require verification of any path constructed from request parameters, ensuring containment within a defined base directory.
- Security tests and fuzzing that automatically inject traversal sequences (
../,..\\, URL-encoded variants) into path-related parameters in APIs like/api/media/subtitles. - Runtime monitoring or logging that highlights suspicious access attempts to unexpected directories or files outside the configured storage root.
- Integration of automated review tools that enforce policies around filesystem access patterns and highlight deviations from approved path-handling utilities.

