CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-62MM-XWMV-CRHG

GHSA-62MM-XWMV-CRHG: Unauthenticated Path Traversal in Khoj Static File Serving Endpoint

Alon Barad
Alon Barad
Software Engineer

Sep 26, 2026·5 min read·2 visits

Executive Summary (TL;DR)

An unauthenticated path traversal flaw in Khoj enables remote attackers to read sensitive files, databases, and API keys by using directory traversal sequences on the static landing page file router.

An unauthenticated path traversal vulnerability exists in the Khoj AI assistant platform via the static file serving endpoint `/home/{file_path:path}`. Due to improper path sanitization when handling user input with Python's pathlib module, a remote attacker can read arbitrary files from the server's filesystem.

Vulnerability Overview

The application Khoj is an open-source, self-hosted AI research copilot designed to aggregate, index, and query personal documents, integrating closely with various Large Language Models (LLMs). To support its default landing interface, the application exposes a public, unauthenticated HTTP endpoint designated for serving static files.

A path traversal vulnerability (classified as CWE-22) resides within this public asset serving routine. Because the application fails to validate the boundaries of user-supplied paths, remote unauthenticated attackers can escape the intended static asset directory.

This security bypass allows the retrieval of sensitive system and application files. Successful exploitation does not require active sessions or specialized user interaction, placing all deployments directly exposed to the internet at immediate risk of data exposure.

Root Cause Analysis

The root cause of this vulnerability lies in the implementation of the /home/{file_path:path} endpoint within src/khoj/routers/web_client.py. This route employs FastAPI's wildcard path converter ({file_path:path}), which accepts arbitrary sub-paths, including directory traversal sequences such as ../ and forward slashes.

To resolve the local file path, the application uses the Python standard library's pathlib module. The router directly concatenates the hardcoded base landing page directory constants.home_directory with the raw, user-supplied file_path string using the pathlib division (/) operator.

While the pathlib.Path class structures paths logically, its division operator does not perform canonicalization or prevent relative references from navigating outside the parent directory. When the resulting un-normalized path is passed directly to Starlette's FileResponse object, the underlying operating system resolves the relative directory segments and retrieves the target file. No security middleware or access filters were present to validate that the resolved file remained inside the designated static root directory.

Code Analysis

The original vulnerable route in src/khoj/routers/web_client.py was implemented as follows:

@web_client.get("/home/{file_path:path}", response_class=FileResponse)
def home_static_files(file_path: str):
    """Serve static files from the home landing page directory"""
    # VULNERABLE: Direct concatenation of user input without sanitization or path resolution
    return FileResponse(constants.home_directory / file_path)

The remediation patch introduces validation using standard security patterns for Python's path handling:

@web_client.get("/home/{file_path:path}", response_class=FileResponse)
def home_static_files(file_path: str):
    """Serve static files from the home landing page directory"""
    # FIXED: Fully resolve the path, evaluating symlinks and stripping relative sequences
    resolved = (constants.home_directory / file_path).resolve()
    
    # FIXED: Verify that the resolved absolute path remains within the base directory boundaries
    if not resolved.is_relative_to(constants.home_directory.resolve()):
        raise HTTPException(status_code=404)
    return FileResponse(resolved)

By adding the .resolve() method call, the system resolves any symbolic links and strips out redundant relative directory path elements. The addition of is_relative_to() acts as a strong logical containment check, ensuring that any resolution resulting in a location outside of the base directory is immediately aborted with an HTTP 404 error.

Exploitation Methodology

Exploitation of this vulnerability requires only network-level access to the running Khoj instance. Because the endpoint does not perform any session or identity verification, an attacker can directly submit malformed GET requests to extract targeted system files.

In a standard Linux deployment environment, an attacker can construct directory traversal payloads designed to escape the web root folder. By utilizing multiple URL-encoded or raw ../ sequences, the file system boundary is bypassed.

An example attack request targeting /etc/passwd appears as follows:

GET /home/../../../../../../../../../../../../etc/passwd HTTP/1.1
Host: target-khoj-instance:8000
Connection: close

When processed, the backend concatenates this payload with the internal path. The OS evaluates this to /etc/passwd and returns the target file's content in a 200 OK response. Beyond operating system configuration files, attackers can specifically target application-specific assets. This includes the internal SQLite database (khoj.db) which contains private user document indices and plain-text API credentials.

Impact Assessment

The impact of this path traversal vulnerability is evaluated as High. Due to the nature of Khoj as a personal AI assistant, compromised instances expose extremely sensitive data assets.

Attackers can download the application database, which typically holds indexed local documents, proprietary enterprise notes, and private communication histories. This represents a complete breach of confidentiality for self-hosted instances containing sensitive personal or organizational information.

Furthermore, the configuration files often store active third-party API tokens for services like OpenAI, Anthropic, Gemini, and Deepseek. Exfiltration of these tokens can result in financial loss, API rate limit exhaustion, and potential secondary compromises of connected cloud ecosystems.

Remediation and Defense-in-Depth

To fully address this vulnerability, administrators must upgrade their Khoj deployments to version 2.0.0-beta.25 or higher. This version natively integrates secure path resolution and containment checking.

If immediate patching is not possible, system administrators should deploy restrictive rules on reverse proxies or web application firewalls (WAFs). Ingress traffic filters can block requests directed to /home/ that contain dot-dot-slash patterns or equivalent hexadecimal encodings.

As a secure deployment practice, ensure the Khoj application runs within an isolated environment under a dedicated, low-privilege system user account. Limiting the execution account's filesystem read permissions ensures that even if a path traversal vulnerability is exploited, the attacker's visibility is confined only to non-critical files.

Official Patches

khoj-aiFix commit implementing safe path resolution and boundary verification

Fix Analysis (2)

Technical Appendix

CVSS Score
7.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Affected Systems

Khoj AI Assistant Deployments running versions >= 2.0.0-beta.20 and < 2.0.0-beta.25

Affected Versions Detail

Product
Affected Versions
Fixed Version
khoj
khoj-ai
>= 2.0.0-beta.20, < 2.0.0-beta.252.0.0-beta.25
AttributeDetail
CWE IDCWE-22 (Path Traversal)
Attack VectorNetwork
CVSS v3.1 Score7.5 (High)
Exploit StatusPoC Available
KEV StatusNot Listed
Mitigated Version2.0.0-beta.25

MITRE ATT&CK Mapping

T1083File and Directory Discovery
Discovery
T1552Unsecured Credentials
Credential Access
T1212Exploitation for Credential Access
Credential Access
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The software uses external input to construct a pathname that is intended to identify a file or directory that is located under a restricted directory, but the software does not properly neutralize special elements within the pathname.

Known Exploits & Detection

GitHub Advisory DatabaseOfficial advisory with detailed vulnerability description and remediation commit reference.

Vulnerability Timeline

Vulnerability introduced via commit 9801ffd2de642772f072ca496032b7c352013b6a
2025-12-29
Vulnerability remediated via commit 21c51b9ace4eb59ce79ac0a93b917289824195cf
2026-02-22
Secure release tag 2.0.0-beta.25 distributed
2026-02-22
Security Advisory GHSA-62MM-XWMV-CRHG published
2026-02-22

References & Sources

  • [1]GitHub Advisory GHSA-62MM-XWMV-CRHG
  • [2]Remediation Commit
  • [3]Introduction Commit
  • [4]Khoj 2.0.0-beta.25 Release

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•14 minutes ago•CVE-2026-53493
6.9

CVE-2026-53493: Uncontrolled Resource Consumption in containerd Image-Pull Descriptor Graph Resolution

containerd is an open-source container runtime. Prior to versions 1.7.36, 2.0.13, 2.2.9, 2.3.6, and 2.4.1, a crafted OCI index graph can force very high CPU/memory usage during PullImage (before container start), causing long ContainerCreating stalls and, at larger sizes, node/runtime instability. The vulnerability occurs because containerd's image-pull descriptor graph resolution handlers processed OCI image indices and manifests recursively without enforcing boundaries on traversal depth or breadth, and without maintaining a global visited registry to count duplicate references.

Alon Barad
Alon Barad
2 views•6 min read
•about 2 hours ago•CVE-2026-100369
8.4

CVE-2026-100369: Argument Injection Vulnerability in CliInvoke Process Runner Factories

An argument injection vulnerability (CWE-88) in CliInvoke and AlastairLundy.CliInvoke allows local attackers to execute arbitrary system commands. By injecting double-quote characters into target file paths or arguments, attackers can terminate operating-system-level quoted boundaries and introduce new commands when shell runners are utilized.

Amit Schendel
Amit Schendel
2 views•5 min read
•about 3 hours ago•CVE-2026-100368
8.4

CVE-2026-100368: OS Command Injection in CliInvoke Shell Wrappers

An OS command injection vulnerability exists in the PowerShell and Cmd shell wrappers of the CliInvoke .NET library (specifically the CliInvoke.Specializations package). Under vulnerable configurations, arguments and targets are passed as a single flat string to ProcessStartInfo.Arguments, permitting double-quote breakout and execution of arbitrary secondary commands with host process privileges.

Amit Schendel
Amit Schendel
3 views•7 min read
•about 4 hours ago•GHSA-VV77-66RF-PM86
8.8

GHSA-vv77-66rf-pm86: Gas Draining Vulnerability in mpp Multi-Party Payments Library

A critical-severity input validation vulnerability in the Elixir multi-party payment library `mpp` allows unauthenticated remote attackers to exhaust the transaction fee payer's wallet balance. By submitting a crafted Ethereum transaction envelope with artificially inflated gas parameters, an attacker can force the server to co-sign and commit to pay exorbitant fees, leading to severe financial loss and Denial of Service.

Amit Schendel
Amit Schendel
4 views•5 min read
•about 5 hours ago•GHSA-QPXH-FF8M-C62V
7.5

GHSA-QPXH-FF8M-C62V: Gas Draining and Resource Exhaustion in ZenHive mpp Library

A critical gas draining vulnerability exists in the ZenHive mpp (Multi-Payment Protocol) library prior to version v0.6.0. By omitting validation of EIP-2930 access lists in custom 0x76 transaction envelopes, the library allows malicious clients to pad transaction payloads with dummy addresses, draining the gas sponsor's hot wallet.

Amit Schendel
Amit Schendel
4 views•8 min read
•about 6 hours ago•GHSA-VJ8P-HP9X-GH47
8.8

GHSA-vj8p-hp9x-gh47: Zero-Cost Fee-Payer Wallet Gas Draining in mpp Elixir Library

A high-severity vulnerability exists in the Elixir library `mpp` (Multi-Party Payments) prior to version `0.6.0`. When acting as a sponsored transaction fee payer, the server co-signs and broadcasts user-provided transactions without verifying if the user-specified gas limit is sufficient. An attacker can submit transactions designed to run out of gas and revert. The transaction reversion ensures the attacker pays zero fees, while the sponsor's fee-payer wallet is fully billed for the wasted gas, resulting in a low-cost, high-impact Denial of Service (DoS) vector.

Amit Schendel
Amit Schendel
3 views•6 min read