/

CVE-2026-86775

Severity:

HIGH RISK

(8.6)

Path Traversal (CWE-22) in knowns Document API Handler

CVE-2026-86775

Awaiting Analysis

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read and Write

Severity:

HIGH RISK

(8.6)

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 the knowns Document API allows user-controlled document paths to escape the configured documents directory. When the Management API is reachable and insufficiently protected, an unauthenticated remote attacker may read, create, overwrite, or delete host files ending in .md, and may create directories.

Affected context

The vulnerability occurs in the Document API when supplied document paths are normalized without removing parent-directory traversal sequences. The storage layer then joins the resulting path with the documents directory without confirming that the resolved location remains within that directory. Risk is highest in deployments where the Management API is unauthenticated, exposed beyond a trusted administrative network, and permitted to access a broadly writable or readable filesystem.

Exploit preconditions

  • Attack surface: Document API HTTP endpoints, including document creation, retrieval, and deletion operations
  • Required access: Network access to the Management API; authentication may not be required in default deployments
  • Trigger point: Processing a user-controlled document path and constructing the filesystem target path
  • Why exploitation is possible: Parent-directory segments are preserved during normalization, and the resulting path is not verified against the configured documents directory before filesystem operations occur

Why this happens

The underlying bug is insufficient canonicalization and containment validation for user-controlled filesystem paths. The handler removes selected formatting elements but does not neutralize traversal components, while the storage layer uses path joining without resolving the final path and enforcing that it remains beneath the intended base directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

Potential impact

  • An attacker may read sensitive documentation files outside the intended directory
  • An attacker could create or overwrite files with a .md extension
  • An attacker may delete accessible matching files
  • The application could create arbitrary directories through recursive directory creation
  • Documentation for other projects may be exposed or corrupted
  • The file-write primitive could be chained with another weakness toward code execution

General mitigation guidance

Mitigation generally focuses on treating document paths as untrusted identifiers rather than filesystem paths.

Common defensive patterns include:

  • Resolve candidate paths against a trusted base directory and reject any result outside that directory
  • Reject parent-directory components, absolute paths, and platform-specific separator variants
  • Prefer opaque document IDs or tightly constrained relative names over user-selected filesystem paths
  • Apply strict allowlists for permitted characters, extensions, and directory depth
  • Use filesystem permissions and service identities that limit readable and writable locations
  • Require authentication and authorization for management operations, and bind administrative APIs to trusted interfaces
  • Avoid exposing arbitrary filesystem errors or path details in API responses

These controls reduce both direct traversal risk and the impact of a compromised application process.

How teams detect issues like this

Detection approaches commonly include:

  • Static analysis rules for filesystem joins that use request parameters without canonicalization and containment checks
  • Code review checks for path handling involving filepath.Join, path normalization, file deletion, and recursive directory creation
  • Tests using parent-directory segments, absolute paths, encoded separators, and platform-specific path forms
  • Runtime monitoring for document API requests containing traversal indicators or unusual encoded path components
  • File-integrity monitoring for unexpected changes outside the configured documents directory
  • Policy enforcement requiring authentication, network restrictions, and least-privilege filesystem access for management APIs

Automated code-review and software-composition tools may help identify related path-handling patterns, but should be supplemented with targeted behavioral tests.

Sources

SourceLink
github.comgithub.com/knowns-dev/knowns/security/advisories/GHSA-3h35-4jq7-hv45
vulncheck.comvulncheck.com/advisories/knowns-before-0.30.0-path-traversal-via-document-api

Frequently asked

questions

It can be remotely exploitable when the Management API is network-accessible and lacks effective authentication or authorization. The default deployment posture described for this issue may allow unauthenticated access.

An attacker needs HTTP access to the affected Document API and an operation that accepts a controllable document path. Local filesystem permissions still determine which files can be read, changed, or removed.

Treat document paths as untrusted input, resolve them against a fixed documents directory, and reject any resolved path that falls outside that directory. Restricting document names to safe identifiers is an additional strong design alternative.

Combine canonical path containment checks with strict input validation, least-privilege service accounts, protected management endpoints, negative traversal tests, and monitoring for unexpected filesystem activity.

Find out what's already
exploitable in your codebase.