/

CVE-2026-88937

Severity:

HIGH RISK

(8.8)

Path Traversal (CWE-22) in Knowns Template Codegen Engine

CVE-2026-88937

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read and Write

Severity:

HIGH RISK

(8.8)

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

Knowns through version 0.33.0 does not properly validate destination paths used by its code generation template engine. An attacker who can supply or influence malicious templates may read or overwrite files outside the intended project root, potentially exposing credentials, modifying shell profiles, or achieving persistent code execution.

Affected context

The vulnerability occurs in deployments that use the Knowns code generation template engine and process templates from an attacker-influenced source. It becomes risky when generated destination paths are resolved without reliably constraining them to the project root, allowing traversal sequences or equivalent path manipulation to escape the intended directory.

Exploit preconditions

  • Attack surface: Code generation workflows that process externally supplied or insufficiently trusted templates
  • Required access: Ability to provide, modify, or cause the application to process a malicious template
  • Trigger point: Template rendering or file generation when destination paths are resolved
  • Why exploitation is possible: Destination paths are not adequately canonicalized and bounded to the project root before file access

Why this happens

The underlying bug is improper validation of user-influenced file destination paths. When a template engine joins attacker-controlled path components with a trusted project directory without canonicalizing the result and verifying that it remains within the permitted root, traversal components can redirect file operations elsewhere on the system. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

Potential impact

  • Sensitive files, credentials, or configuration data could be read
  • Arbitrary files could be overwritten or corrupted
  • Shell profiles or startup configuration could be modified
  • Persistent code execution could occur under the affected process's privileges
  • Project integrity and generated artifacts could be compromised

General mitigation guidance

Mitigation generally focuses on enforcing a strong destination-directory trust boundary for all generated files.

Common defensive patterns include:

  • Canonicalizing destination paths before any file operation
  • Verifying that resolved paths remain beneath an approved project root
  • Rejecting traversal components, absolute paths, and symlink-based escapes where appropriate
  • Using secure-by-default APIs that accept constrained relative paths
  • Separating template input from filesystem destination policy
  • Running generation processes with the minimum filesystem permissions required
  • Avoiding writable access to shell profiles, credential stores, and sensitive system locations

How teams detect issues like this

Organizations can look for path traversal risks through:

  • Static analysis rules targeting unsafe path joins and file writes using template-derived values
  • Code review checks for missing canonicalization and root-containment validation
  • Tests covering relative traversal, absolute paths, encoded separators, symlinks, and platform-specific path behavior
  • Runtime monitoring for generation processes accessing files outside approved project directories
  • Policy enforcement that restricts code generation jobs to isolated, least-privilege workspaces

Automated code review and software composition tools may help identify unsafe filesystem handling patterns.

Sources

SourceLink
github.comgithub.com/knowns-dev/knowns/blob/v0.33.0/internal/codegen/template_engine.go#L318-L344
github.comgithub.com/knowns-dev/knowns/blob/v0.33.0/internal/codegen/template_engine.go#L625-L636
github.comgithub.com/knowns-dev/knowns/security/advisories/GHSA-68cq-4rwm-f7jr
github.comgithub.com/knowns-dev/knowns/security/advisories/GHSA-xjcg-5j3r-m6f9
vulncheck.comvulncheck.com/advisories/knowns-through-0.33.0-path-traversal-via-template-engine

Frequently asked

questions

It may be exploitable remotely when an exposed service accepts or processes attacker-controlled templates. In local-only workflows, exploitation generally requires access to the template source or generation process.

The attacker needs a way to supply, modify, or trigger processing of a malicious template. The resulting impact also depends on the filesystem permissions of the Knowns process.

Resolve destination paths canonically, then enforce that they remain within an approved project root before reading or writing files. Reject absolute paths and traversal or symlink escapes as appropriate.

Treat template-derived paths as untrusted input, apply centralized path validation, test platform-specific edge cases, and run generation workloads with restricted filesystem privileges.

Find out what's already
exploitable in your codebase.