/

CVE-2026-35605

Severity:

HIGH RISK

(7.5)

Path Traversal in File Browser Access Rules

CVE-2026-35605

Analyzed

Vulnerability type

Category:

Path Traversal / Directory Traversal

CWE:

CWE-22

Impact:

Unauthorized File System Access

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

File Browser's access control logic previously matched protected paths using a simple string prefix check, causing rules defined for one directory (such as /uploads) to also apply to similarly named directories (like /uploads_backup/).

Under these conditions, an attacker could gain unauthorized access to unintended directories or be incorrectly denied access, depending on how the rules were configured.

Affected context

This vulnerability arises in File Browser deployments that rely on path-based access rules to restrict or grant access to directories.

The Matches() function in rules/rules.go used strings.HasPrefix() without verifying a trailing path separator, so any directory whose path merely started with the rule's path could be affected.

Environments with multiple similarly named directories (e.g., /uploads and /uploads_backup/) are particularly exposed, because rule definitions may unintentionally apply to both.

Exploit preconditions

  • Attack surface: File Browser HTTP interface (web UI or API endpoints handling file operations).
  • Required access: Ability to authenticate or otherwise reach a File Browser instance where access rules are configured for specific directories.
  • Trigger point: Submitting file operations (upload, read, delete, rename, edit, or list) targeting paths that partially match an existing rule's directory prefix (e.g., /uploads_backup/ when there is a rule for /uploads).
  • Why exploitation is possible: The access rule evaluation relies on strings.HasPrefix() without enforcing a directory boundary, so any path that begins with the rule path string is treated as covered by that rule, even if it refers to a different directory.

Why this happens

The root cause is a logic flaw in path validation and authorization: directory-based access rules are evaluated using a plain string prefix match rather than a path-aware comparison.

By using strings.HasPrefix() without requiring a trailing directory separator or canonicalization of paths, the implementation conflates similarly named directories.

This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because the system fails to strictly confine access rules to the intended directory boundaries.

Potential impact

  • Unauthorized read access to files in directories that only partially match a rule path.
  • Unauthorized write, upload, or deletion of files in unintended directories.
  • Accidental over-restriction, where legitimate users lose access to directories due to misapplied rules.
  • Potential exposure or corruption of application data stored in misprotected directories.

General mitigation guidance

Mitigation centers on enforcing path-aware, boundary-safe matching for authorization decisions, rather than naive string comparisons.

Recommended defensive patterns include:

  • Normalize and canonicalize all paths before evaluation (resolving . and .., symbolic links where feasible, and consistent separators).
  • Compare full path segments, requiring a trailing directory separator or exact match for directory rules.
  • Prefer filesystem-path libraries or helper functions that operate on path components instead of raw string APIs.
  • Keep access control rules simple and explicit, avoiding overlapping directory names where possible.
  • Apply least-privilege principles to directory permissions, granting only the minimal needed scope per role or user group.

How teams detect issues like this

Effective detection focuses on finding and auditing path-based authorization logic:

  • Static analysis: Flag uses of generic string prefix/substring operations (HasPrefix, Contains) in code paths that implement authorization or directory checks.
  • Code review: Examine access control modules (rules/rules.go and similar) for path comparison logic; verify they use normalized paths and segment-aware comparison.
  • Security testing: Create test cases where two directories share a common prefix (e.g., /data and /data_backup) and verify that rules for one do not affect the other.
  • Automated policy checks: Integrate secure coding guidelines into CI, enforcing that path authorization uses helper functions or utilities designed for safe path handling.

Sources

SourceLink
github.comgithub.com/filebrowser/filebrowser/pull/5889
github.comgithub.com/filebrowser/filebrowser/security/advisories/GHSA-5q48-q4fm-g3m6

Frequently asked

questions

Yes, if the File Browser instance is exposed over the network and an attacker can interact with its web interface or API. Exploitation involves crafting file operations that target directories whose names share prefixes with protected paths.

In most deployments, practical exploitation requires at least some level of access (e.g., a low-privilege user account) to reach file operations governed by access rules. However, if anonymous or public access is allowed and governed by these rules, then the impact can apply to unauthenticated users as well.

Replace naive string-based path matching with robust, normalized, segment-aware path comparisons. Ensure that access rules apply only to the exact directory or its descendants by verifying directory boundaries (e.g., using canonical paths and requiring a trailing separator for directories).

Establish a standard utility for path authorization checks and mandate its use across the codebase, avoid ad hoc use of string APIs for path security decisions, add automated tests for edge cases with overlapping directory names, and incorporate static analysis or code review checklists that flag unsafe path handling in access control logic.

Find out what's already
exploitable in your codebase.