Summary
A path traversal vulnerability in File Browser's upload failure cleanup logic allows scoped users with only Create permissions to delete files outside their assigned directory.
If a symlink escaping the scope already exists, the cleanup routine can follow it and remove arbitrary out-of-scope files, including other tenants' data and application assets, under normal authenticated usage conditions.
Affected context
This vulnerability appears in multi-tenant or scoped deployments of File Browser where user access is restricted to a specific directory tree.
It is relevant when:
- Users are granted only Create (upload) permissions without Delete rights
- The system permits or does not adequately control the presence of symlinks within scoped directories
- Direct upload handlers rely on cleanup routines that operate on user-controlled paths
Under these conditions, cleanup operations can cross scope boundaries and affect shared or application-critical files.
Exploit preconditions
- Attack surface: Authenticated web interface or API endpoints handling direct file uploads.
- Required access: Valid scoped File Browser account with at least Perm.Create; no need for Perm.Delete or admin privileges.
- Trigger point: Initiation of a direct-upload that fails (or is made to fail) so that the upload failure-cleanup path runs on a user-controlled directory or file path.
- Why exploitation is possible: The ScopedFs.RemoveAll helper skips the symlink guard enforced by other filesystem operations and is gated only by Create permission. If an escaping symlink already exists within the user's scope, RemoveAll can dereference it and recursively delete the out-of-scope target, bypassing both directory scoping and delete permission checks.
Why this happens
The root cause is an inconsistent application of path and symlink safety checks in filesystem helper utilities.
Most ScopedFs operations enforce a symlink guard to ensure that logical scope boundaries are respected and that paths cannot escape assigned directories. However, the ScopedFs.RemoveAll routine omits this guard, performing recursive deletion on the resolved path without confirming it remains within the scoped root.
This behavior aligns with CWE-22 (Improper Limitation of a Path to a Restricted Directory) and CWE-59 (Improper Link Resolution Before File Access), where user-influenced paths or symbolic links are trusted for destructive filesystem actions. The mismatch between permission checks (Perm.Create vs. Perm.Delete) and cleanup semantics further amplifies the impact, allowing a non-delete-capable user to trigger deletion of arbitrary targets reachable via symlink traversal.
Potential impact
- Deletion of other tenants' files and directories that are reachable through symlink traversal.
- Removal of application-critical data, such as the File Browser database or configuration files.
- Partial or complete loss of content stored on the underlying filesystem.
- Service downtime or corruption if essential application assets are removed.
- Breach of isolation guarantees in multi-tenant or scoped deployments.
General mitigation guidance
Mitigation focuses on enforcing consistent path validation and symlink handling across all filesystem operations, particularly destructive ones.
Recommended patterns include:
- Applying the same symlink guard logic to all helpers that can delete or modify files, ensuring that resolved paths remain within the configured scope root.
- Treating cleanup routines as security-sensitive operations: require appropriate delete-level permissions for recursive removal and avoid performing destructive actions based solely on create permissions.
- Normalizing and validating paths before any filesystem operation, rejecting or limiting follow-through when path resolution escapes the intended directory tree.
- Minimizing reliance on user-controlled paths in automatic cleanup logic and separating tenant-specific storage from application- or system-level data.
- Restricting the creation or retention of symlinks inside scoped directories, or enforcing policies that prevent symlink chains from pointing outside the allowed root.
How teams detect issues like this
Effective detection typically combines code-level and operational controls:
- Static analysis configured to flag filesystem helpers that perform deletion or modification without consistent path normalization and symlink checks, especially when paths are derived from user input.
- Code review practices that highlight differences between ScopedFs routines, ensuring all follow the same security model for symlink resolution and scope enforcement.
- Security tests or fuzzing targeting directory operations: verify that cleanup routines cannot cross scope boundaries and that permission gates align with the actions performed.
- Policy enforcement in CI/CD pipelines requiring review of changes to file-management and cleanup logic, as well as periodic scans for CWE-22/CWE-59 patterns using automated tools.

