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·27 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

•about 2 hours ago•CVE-2026-9639
6.5

CVE-2026-9639: Authenticated Denial of Service via Nil-Pointer Dereference in Canonical LXD Custom Volume Backup Import

CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.

Amit Schendel
Amit Schendel
5 views•9 min read
•about 3 hours ago•CVE-2026-33050
8.8

CVE-2026-33050: OS Command Injection in GeoNode Vector Upload Handler

An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.

Alon Barad
Alon Barad
5 views•9 min read
•about 4 hours ago•CVE-2026-46429
5.5

CVE-2026-46429: Unrestricted File Upload and Validation Bypass in GeoNode

GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.

Amit Schendel
Amit Schendel
5 views•10 min read
•about 5 hours ago•CVE-2026-55649
6.3

CVE-2026-55649: Stored Cross-Site Scripting in GeoNode Document Metadata Abstract Field

CVE-2026-55649 is a stored Cross-Site Scripting (XSS) vulnerability in GeoNode versions prior to 5.0.3. The flaw exists because document abstract metadata fields are ingested via the metadata management pipeline and stored in the backend database without HTML sanitization or input neutralization. An authenticated attacker with privileges to create or edit document metadata can inject arbitrary HTML and JavaScript payloads into these fields. When another user, such as an administrator, views the affected document page or catalog listing, the unencoded payload is rendered into the Document Object Model (DOM) and executes within the victim's browser session.

Amit Schendel
Amit Schendel
7 views•9 min read
•about 6 hours ago•GHSA-QX75-2P3R-PWM5
7.7

CVE-2026-55622: Cross-Project Instance Copy Authorization Bypass in Canonical LXD and LXC Incus

CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.

Amit Schendel
Amit Schendel
6 views•11 min read
•about 7 hours ago•GHSA-7MR3-28H5-M5VX
7.7

GHSA-7mr3-28h5-m5vx: Authorization Bypass and Cross-Project Volume Copy in Canonical LXD

An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.

Alon Barad
Alon Barad
5 views•10 min read