/

CVE-2026-86538

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in knowns Template Preview Endpoint

CVE-2026-86538

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read and Information Disclosure

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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/preview HTTP endpoint
  • Required access: Network access to the endpoint; authentication is not required
  • Trigger point: Processing the attacker-controlled templateFile parameter
  • 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.

Sources

SourceLink
github.comgithub.com/knowns-dev/knowns/blob/v0.29.1/internal/server/routes/templates.go#L299-L310
github.comgithub.com/knowns-dev/knowns/commit/09c5a96fd5817b941dc86669278c1a17db10ed4e
github.comgithub.com/knowns-dev/knowns/releases/tag/v0.30.0
github.comgithub.com/knowns-dev/knowns/security/advisories/GHSA-fpxv-c555-rhm3
vulncheck.comvulncheck.com/advisories/knowns-before-0.30.0-path-traversal-via-templatefile-parameter

Frequently asked

questions

Yes. If the template preview endpoint is network-reachable, an unauthenticated attacker may be able to submit crafted path values remotely.

The described issue does not require authentication, but the attacker must be able to reach the affected HTTP endpoint.

Avoid accepting arbitrary filesystem paths. Use allowlisted template identifiers, canonicalize any remaining path input, and enforce that resolved files stay within a dedicated template directory.

Apply least-privilege filesystem permissions, keep secrets outside application-readable template locations, test traversal variants, and use code review or automated analysis to detect untrusted input reaching file operations.

Find out what's already
exploitable in your codebase.