Summary
Zr.Admin.NET contains a path traversal vulnerability in /common/DownloadFile that can let a logged-in user read files outside the intended download location. If sensitive configuration files are accessible, their contents may expose the JWT signing secret, which could be used to forge administrator tokens.
Affected context
The issue affects the /common/DownloadFile endpoint in the specified Zr.Admin.NET commit range. It becomes risky when the endpoint accepts a user-controlled path without reliably restricting file access to an intended directory; readable application settings may contain sensitive authentication material.
Exploit preconditions
- Attack surface: The
/common/DownloadFileendpoint - Required access: A logged-in account
- Trigger point: A request that supplies a path to the download endpoint
- Why exploitation is possible: Path traversal or absolute paths may allow access beyond the intended download location if paths are not safely constrained
Why this happens
The underlying issue is insufficient validation and containment of a user-controlled file path. When an application uses that path to locate a file without ensuring the resolved location remains within an authorized directory, traversal can expose unintended files. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Potential impact
- An authenticated user may read files outside the intended download area.
- Sensitive configuration values, including a JWT signing secret, could be exposed if the relevant file is readable.
- An attacker could potentially forge administrator tokens if the exposed secret is accepted for token validation.
- Disclosure of other server files could reveal additional sensitive information.
General mitigation guidance
Defensive patterns focus on limiting file access to an explicit, authorized area:
- Resolve requested paths and verify that the resulting location remains within an approved directory.
- Prefer server-side file identifiers or allowlisted filenames over accepting arbitrary paths.
- Reject absolute paths and traversal attempts as an additional validation layer.
- Keep secrets out of files reachable through download functionality, and protect secret storage and access.
- Apply least-privilege permissions so the application can read only files required for its function.
How teams detect issues like this
Review file-serving code for user-controlled paths passed to filesystem operations without canonicalization and directory-boundary checks. Static analysis can flag path joins and file reads that use request parameters; code review can verify authorization, path containment, and file allowlisting. Runtime monitoring and policy checks may also identify suspicious download requests or access to sensitive configuration files.

