Summary
The zrok WebDAV drive backend follows symbolic links inside the shared drive root without enforcing that their targets remain within that root, enabling path traversal via symlinks.
A remote WebDAV client that can write or control files under the shared DriveRoot may be able to read and, where OS permissions allow, write or overwrite arbitrary files on the host filesystem accessible to the zrok process.
Affected context
This vulnerability affects deployments using the zrok WebDAV drive backend (davServer.Dir) to expose a directory tree as a share.
The issue arises when:
- The shared WebDAV DriveRoot contains or can be made to contain symbolic links
- Those symlinks can point to directories or files outside the intended DriveRoot
- The underlying OS filesystem permissions allow the zrok process to access those external targets
In such setups, remote WebDAV consumers interacting with the share can traverse out of the logical root via symlinks even though lexical path normalization is applied.
Exploit preconditions
- Attack surface: Network-accessible zrok WebDAV shares (HTTP/WebDAV interface).
- Required access: Ability to interact with the WebDAV endpoint as a client; in many configurations this includes the ability to upload, rename, or otherwise create filesystem entries under the shared DriveRoot.
- Trigger point: A WebDAV file or directory operation (e.g., PROPFIND, GET, PUT, MOVE, COPY, MKCOL) that resolves a path containing or traversing through a symbolic link located under the DriveRoot.
- Why exploitation is possible:
- The backend prevents simple
../-style directory traversal through lexical normalization but does not constrain filesystem resolution of symlinks. - As a result, a symlink stored under the DriveRoot can point to any location on the host filesystem reachable by the zrok process.
- Subsequent WebDAV operations on paths that include that symlink are executed against the symlink target, not the intended bounded root.
Why this happens
The core issue is an incomplete path confinement strategy: the backend normalizes input paths to remove .. segments (mitigating direct lexical traversal) but relies on the OS to resolve filesystem paths, including symbolic links, without re-verifying that the resolved path still resides within the intended root directory.
This design maps to:
- CWE-61: Improper Restriction of Symlink Following, where the application follows symlinks without enforcing contextual boundaries.
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), because the intended directory restriction can be bypassed using symlink-based traversal.
Conceptually, the system trusts the apparent location of files under the DriveRoot but does not enforce that the effective location after symlink resolution remains constrained, enabling access outside the logical sandbox.
Potential impact
- Remote WebDAV consumers may read arbitrary files on the host filesystem that are readable by the zrok process, including configuration files or sensitive data.
- On shares where OS-level permissions are permissive, remote clients could write or overwrite files outside the intended share, potentially:
- Corrupting application or system files
- Altering configuration files to influence other services
- Planting or modifying data used by other processes
- Expansion of an initial WebDAV share into a broader filesystem exposure, undermining isolation expectations.
- Facilitation of further compromise when combined with other weaknesses (e.g., overwriting scripts or configuration executed by higher-privileged components).
General mitigation guidance
Effective mitigation centers on enforcing a strict directory boundary that survives symlink resolution and reducing the trust placed in filesystem entries under the share:
- Constrain resolved paths, not just input strings:
- After resolving a requested path (including symlinks), verify that the canonical/absolute path is still within the intended DriveRoot before performing any filesystem operation.
- Reject or neutralize operations that would escape the root, even if requested via symlink.
- Control symlink behavior within shared roots:
- Disallow symlinks in shared directories, or treat them as opaque entries that cannot be traversed.
- Optionally support a configurable policy (allow, deny, or restrict symlink targets to specific subtrees).
- Reduce privilege and filesystem exposure:
- Run the zrok process under a dedicated user with least-privilege access, isolating it to only the directories that must be shared.
- Consider containerization or chroot-style isolation to ensure that even if traversal occurs, the accessible filesystem is tightly bounded.
- Harden share configuration:
- Avoid exposing directories containing sensitive material or configuration files as WebDAV roots.
- Where possible, mount a dedicated, minimal directory as the DriveRoot specifically for sharing.
These patterns focus on structural defenses and confinement rather than relying solely on lexical path checks.
How teams detect issues like this
Detection typically involves a combination of code-centric review and behavioral testing:
- Static analysis and code review:
- Look for filesystem operations that:
- Accept user-influenced paths under a configured root directory, and
- Rely only on string normalization (
clean,filepath.Join, manual removal of..) without post-resolution boundary checks. - Flag use of symlink-following calls that do not validate the final canonical path against the expected root.
- Review WebDAV or file-sharing components for assumptions that "anything under this directory is safe" without accounting for symlinks.
- Policy and configuration checks:
- Implement internal security guidelines requiring canonical path verification before file operations in shared or remotely accessible directories.
- Use automated review tools or linters configured with rules for CWE-22 / CWE-61 patterns, focusing on shared filesystem backends and path resolution logic.
- Dynamic and penetration testing:
- In staging environments, create symlinks under the shared root pointing outside the directory and attempt file operations via WebDAV.
- Monitor logs and filesystem activity for unexpected access to files outside designated share paths when WebDAV requests occur.

