Summary
A logic flaw in File Browser's sharing API allows creation of public share links for paths that do not yet exist, without validating the target file.
When a file is later created at the same path, the previously generated share link immediately exposes the new content, enabling unintended public access under certain deployment scenarios.
Affected context
This vulnerability appears in deployments of File Browser where authenticated users can create public shares via the /api/share/<path> endpoint.
The issue arises when the application records a share for an arbitrary path without verifying that a file exists there, and the environment later allows files to be created at those shared paths.
Configurations that rely on path-based access controls or assume shares only refer to existing files are more likely to be affected.
Exploit preconditions
- Attack surface: HTTP API endpoints, specifically
POST /api/share/<path>andGET /api/public/dl/<hash>. - Required access: Valid authenticated access to create shares for arbitrary paths within the managed directory.
- Trigger point: Creation of a share record for a non-existent file path, followed by a file being created at that same path.
- Why exploitation is possible: The share creation logic does not enforce existence checks or revalidate the link when the underlying file is created, effectively decoupling authorization from resource state.
Why this happens
The core issue stems from authorization decisions being made without a complete understanding of the resource state, aligning with CWE-863 (Improper Authorization).
The share creation handler accepts arbitrary paths and persists public share metadata even when no file exists at that location, treating the operation as valid.
When a file is later created at that path, the pre-existing share metadata automatically grants public access, demonstrating a broken assumption that resource creation will not retroactively change past authorization decisions.
Potential impact
- Public exposure of newly created files that were never intended to be shared.
- Bypass of administrative controls that rely on validating share operations against existing files.
- Accidental disclosure of sensitive information uploaded to previously shared, but empty, paths.
- Increased risk of data leakage in multi-user or multi-tenant deployments.
General mitigation guidance
Mitigation typically focuses on tightening authorization checks around share creation and ensuring they are tied to the current resource state.
Common defensive patterns include:
- Requiring that the target file exist and be accessible to the requesting user before any share record is created.
- Binding access control decisions to both user identity and resource existence at the time of the operation.
- Introducing validation layers that reject shares for non-existent or unauthorized paths.
- Designing sharing mechanisms so that new resource creation does not inherit prior public access unless explicitly confirmed.
How teams detect issues like this
High-level detection approaches include:
- Reviewing API handlers for share or link creation to confirm that they perform existence and authorization checks on the target resource.
- Using static analysis or code scanning rules to flag authorization logic that operates solely on paths or identifiers without validating underlying resources.
- Implementing logging and monitoring around share creation and public download endpoints to detect suspicious patterns, such as shares for empty or invalid paths later becoming active.
- Enforcing development-time policies that require explicit resource validation before public access is granted.

