Summary
A path handling flaw in Cloudreve's WebDAV interface allows accounts scoped to a specific folder to access files outside their configured root by using encoded parent-directory sequences.
When an attacker controls a WebDAV account, they can read, list, and, if permitted, modify files beyond their intended directory boundary, turning a scoped credential into broader file-system access.
Affected context
This vulnerability arises in Cloudreve deployments that expose the WebDAV interface and rely on folder-based scoping to restrict what each account can access.
It is relevant when WebDAV credentials are configured to be rooted at a specific directory, but the server joins request paths with the account root without enforcing containment.
Under these conditions, encoded traversal-like paths can effectively escape the configured folder, causing scoped accounts to operate on files in higher-level or sibling directories.
Exploit preconditions
- Attack surface: Cloudreve WebDAV endpoint accessible over the network
- Required access: Valid WebDAV credentials scoped to a configured folder (read-only or writable)
- Trigger point: Sending WebDAV requests with URL-encoded path segments such as
%2e%2ethat resolve outside the account's root directory - Why exploitation is possible: The
stripPrefixlogic inpkg/webdav/webdav.gousesfs.URI.JoinRawto join the decoded request suffix with the account root but does not verify that the resulting path remains within the configured folder, leading to an authorization rule bypass
Why this happens
The underlying issue is an authorization implementation flaw where path normalization and containment checks are incomplete.
Cloudreve's WebDAV handler trusts joined paths produced by fs.URI.JoinRaw without enforcing that the final resolved path stays under the account's designated root directory.
This maps to CWE-863: Incorrect Authorization, because the system fails to apply the intended access control policy when processing specially crafted, encoded paths, allowing users to perform operations on resources that should be outside their scope.
Potential impact
- Scoped WebDAV accounts may read files outside their configured folder.
- Attackers could list directory contents beyond the intended root, exposing sensitive metadata.
- Writable WebDAV credentials could create or overwrite files in higher-level or sibling directories.
- Files may be moved or deleted outside the authorized scope, leading to data loss or tampering.
General mitigation guidance
Effective mitigation focuses on enforcing strict path containment and robust authorization checks for WebDAV operations.
Common defensive patterns include:
- Normalizing and resolving request paths against the account root before authorization, then rejecting any operation that would escape the configured directory.
- Treating URL-encoded segments and traversal-like components consistently during path resolution, so that encoded variants cannot bypass checks.
- Separating path parsing from authorization logic, ensuring that access control decisions are made on canonical, validated resource paths.
- Applying least privilege for WebDAV accounts, limiting writable access and avoiding broad filesystem exposure wherever possible.
How teams detect issues like this
Detection typically involves reviewing how resource paths are constructed and authorized within the WebDAV handling code.
Helpful approaches include:
- Static analysis rules that flag path-joining functions used in access control logic without subsequent containment verification.
- Manual code review focused on WebDAV request handlers, checking that all paths are normalized and validated against an access-controlled root before file operations.
- Logging and monitoring of WebDAV requests containing encoded traversal-like segments (e.g.,
%2e%2e) and correlating them with unusual file access patterns. - Enforcement of secure coding policies that require canonicalization of file paths prior to authorization decisions, audited through automated code review tools integrated in CI pipelines.

