Summary
ZFile through version 5.0.5 does not adequately verify that a requested file is included in the entries permitted by a share link. An attacker who possesses a share link may supply a different file path and download files located beneath the link's shared base directory.
Affected context
The issue occurs in ZFile's share-link download endpoint when file requests are resolved relative to a shared base directory but are not checked against the specific files or entries authorized by the link. Deployments are at risk when share links provide access to sensitive files beneath that directory and an attacker can submit controlled path query parameters.
Exploit preconditions
- Attack surface: Share-link file download endpoint
- Required access: A valid share link or equivalent ability to reach the download request
- Trigger point: A user-controlled file path supplied as a download query parameter
- Why exploitation is possible: Authorization is associated with the shared base directory but is not consistently enforced against the requested entry
Why this happens
The underlying flaw is an authorization decision based on an overly broad resource boundary. The application resolves a user-controlled path within the share's base directory but fails to confirm that the resulting file is one of the entries explicitly authorized by the share link. This behavior maps to CWE-639: Authorization Bypass Through User-Controlled Key, because attacker-controlled resource identifiers influence access decisions without sufficiently binding the request to the permitted object.
Potential impact
- An attacker may download unauthorized files from the shared base directory.
- Confidential documents or application data could be disclosed.
- Exposed files may contain credentials, tokens, or sensitive configuration.
- The vulnerability could support further compromise if downloaded data enables access to other systems.
General mitigation guidance
Mitigation generally focuses on making authorization object-specific rather than directory-wide.
Common defensive patterns include:
- Resolve requested files against a canonical, server-side allowlist of entries associated with the share link.
- Enforce authorization after path normalization and before opening or streaming the file.
- Avoid deriving access solely from user-controlled path values or directory containment checks.
- Use opaque, server-generated file identifiers instead of accepting raw filesystem paths.
- Apply least-privilege permissions to the service account and limit sensitive files outside shareable storage roots.
- Return consistent authorization failures without revealing whether other paths exist.
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis rules identifying filesystem access controlled directly by query parameters.
- Code review checks for missing per-object authorization after path normalization.
- Tests that request files not listed in a share link and verify that access is denied.
- Policy enforcement requiring server-side allowlists or opaque resource identifiers for shared downloads.
- Monitoring for repeated download requests containing unusual, enumerated, or unexpected file names.
Automated application security testing can help identify authorization inconsistencies across shared-resource endpoints.

