Summary
A path traversal vulnerability in knowns allows unauthenticated attackers to bypass intended file path restrictions through the template preview API.
By supplying traversal sequences in the templateFile parameter, an attacker may read arbitrary files, including credentials and configuration data, when the endpoint returns file contents in its JSON response.
Affected context
The vulnerability occurs in knowns versions before 0.30.0 when the POST /api/templates/preview endpoint accepts a user-controlled templateFile value and uses it to locate files on the server. Deployments are at risk when the endpoint is reachable by unauthenticated users and path validation does not reliably constrain access to the intended template directory.
Exploit preconditions
- Attack surface: The
POST /api/templates/previewHTTP endpoint - Required access: Network access to the endpoint; authentication is not required
- Trigger point: Processing the attacker-controlled
templateFileparameter - Why exploitation is possible: Insufficient canonicalization and boundary validation may allow directory traversal sequences to escape the permitted template path and access other readable files
Why this happens
The underlying bug is improper limitation of a user-controlled filesystem path. The application appears to treat the templateFile parameter as a trusted relative path without securely resolving it and verifying that the resulting path remains within the approved directory.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal. The insecure pattern occurs when path input is concatenated or interpreted without robust canonicalization, allowlisting, and directory-boundary enforcement.
Potential impact
- Attackers may read application configuration files
- Credentials, tokens, or private keys could be disclosed
- Sensitive source code or deployment metadata may be exposed
- The vulnerability could support follow-on compromise of connected services
- Exposed data may enable privilege escalation or lateral movement
General mitigation guidance
Mitigation generally focuses on reducing trust in client-supplied paths and enforcing a strict filesystem boundary.
Common defensive patterns include:
- Accepting opaque template identifiers or allowlisted filenames instead of arbitrary paths
- Canonicalizing paths before validation and verifying they remain beneath the intended directory
- Rejecting traversal sequences, absolute paths, symbolic-link escapes, and unexpected path components
- Running the application with a least-privilege service account and limiting readable files
- Keeping credentials and sensitive configuration outside directories accessible to template processing
- Returning only the minimum required template content and avoiding unnecessary file disclosure
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis rules that identify user input flowing into filesystem APIs
- Code review checks for path concatenation without canonicalization and boundary validation
- Tests covering encoded traversal, absolute paths, symbolic links, and platform-specific separators
- Web application monitoring for repeated preview requests containing suspicious path components
- Policy enforcement requiring allowlisted resource identifiers for file-backed API operations
Automated security review tools may help identify data flows from request parameters to file reads, but findings should be validated against deployment-specific path controls.

