CVE-2025-69207: Khoj Khoj Has An IDOR Vulnerability

MODERATE
Advisory Identifier: GHSA-6whj-7qmg-86qj
CVSS 5.4
CWE-639 CWE-862
Published
Advisory Summary

CVE-2025-69207 is a MODERATE (CVSS 5.4) khoj has an idor vulnerability (CWE-639: Authorization Bypass Through User-Controlled Key) affecting Khoj libraries in the PyPI ecosystem. The issue involves khoj has an idor in notion oauth flow that enables index poisoning. Remediation is available in the latest vendor maintenance releases.

CVE-2025-69207 at a Glance

CVE Identifier CVE-2025-69207
GHSA Identifier GHSA-6whj-7qmg-86qj
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-639: Authorization Bypass Through User-Controlled Key
Affected Product Khoj
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2025-69207

To remediate this vulnerability, upgrade all affected Khoj dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

khoj fixed: Latest secure release
pip install khoj>=Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show khoj

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-69207, inspect your installed packages using pip:

pip show khoj

Analyze the terminal output to locate any version of Khoj in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The pip show khoj command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-639: Authorization Bypass Through User-Controlled Key, where the system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. In Khoj, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary An IDOR in the Notion OAuth callback allows an attacker to hijack any user's Notion integration by manipulating the state parameter. The callback endpoint accepts any user UUID without verifying the OAuth flow was initiated by that user, allowing attackers to replace victims' Notion configurations with their own, resulting in data poisoning and unauthorized access to the victim's Khoj search index. This attack requires knowing the user's UUID which can be leaked through shared conversations where an AI generated image is present. ### Details When users share conversations which contain AI generated images, the file path for the image is constructed using the user's UUID. Knowing this UUID, an attacker is able to intercept the OAuth callback for Notion and replace the `state` parameter with the other user's UUID and sync notion onto their account. ### PoC The vulnerable line of code exists in `src/khoj/routers/notion.py` on the callback endpoint. ```python @notion_router.get("/auth/callback") async def notion_auth_callback(request: Request, background_tasks: BackgroundTasks): code = request.query_params.get("code") state = request.query_params.get("state") # <-- Attacker controlled if not code or not state: return Response("Missing code or state", status_code=400) user: KhojUser = await aget_user_by_uuid(state) # <-- No verification! await NotionConfig.objects.filter(user=user).adelete() # <-- Deletes victim's config # ... OAuth token exchange ... access_token = final_response.get("access_token") await NotionConfig.objects.acreate(token=access_token, user=user) # <-- Stores attacker's token ``` To exploit is relatively easy. Once we know the victim's UUID, we simply initiate the Notion sync process on our own account and intercept the callback, replacing the `state` parameter with the victim's UUID. ### Impact Deletes user's existing Notion sync and replaces it with attacker-controlled Notion. Could allow for index poisoning. I'm not entirely sure what Khoj does with synced files but if it's being passed as context to an LLM then I can imagine there's potential here.

CVE-2025-69207 Affected Khoj Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
khoj
PyPI
≤ 2.0.0b25.dev3

References

Frequently Asked Questions

What is CVE-2025-69207?
CVE-2025-69207 is a security vulnerability in Khoj involving Khoj has an IDOR in Notion OAuth Flow that Enables Index Poisoning under CWE-639: Authorization Bypass Through User-Controlled Key.
Which Khoj versions are affected?
Affected versions include releases prior to current release patches across affected packages: khoj.
What version fixes CVE-2025-69207?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is khoj affected?
Yes, khoj is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2025-69207?
CVE-2025-69207 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L.
What CWE is associated with CVE-2025-69207?
CVE-2025-69207 is classified under CWE-639: Authorization Bypass Through User-Controlled Key (The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.).
How can I check PyPI dependencies for CVE-2025-69207?
Run the dependency tree command: 'pip show khoj'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6whj-7qmg-86qj",
  "modified" : "2026-02-03T16:09:54Z",
  "published" : "2026-02-02T17:31:33Z",
  "aliases" : [ "CVE-2025-69207" ],
  "summary" : "Khoj has an IDOR in Notion OAuth Flow that Enables Index Poisoning",
  "details" : "### Summary\nAn IDOR in the Notion OAuth callback allows an attacker to hijack any user's Notion integration by manipulating the state parameter. The callback endpoint accepts any user UUID without verifying the OAuth flow was initiated by that user, allowing attackers to replace victims' Notion configurations with their own, resulting in data poisoning and unauthorized access to the victim's Khoj search index.\n\nThis attack requires knowing the user's UUID which can be leaked through shared conversations where an AI generated image is present.\n\n### Details\nWhen users share conversations which contain AI generated images, the file path for the image is constructed using the user's UUID. Knowing this UUID, an attacker is able to intercept the OAuth callback for Notion and replace the `state` parameter with the other user's UUID and sync notion onto their account.\n\n### PoC\n\nThe vulnerable line of code exists in `src/khoj/routers/notion.py` on the callback endpoint.\n```python\n@notion_router.get(\"/auth/callback\")\nasync def notion_auth_callback(request: Request, background_tasks: BackgroundTasks):\n    code = request.query_params.get(\"code\")\n    state = request.query_params.get(\"state\")  # <-- Attacker controlled\n    if not code or not state:\n        return Response(\"Missing code or state\", status_code=400)\n\n    user: KhojUser = await aget_user_by_uuid(state)  # <-- No verification!\n\n    await NotionConfig.objects.filter(user=user).adelete()  # <-- Deletes victim's config\n    \n    # ... OAuth token exchange ...\n    \n    access_token = final_response.get(\"access_token\")\n    await NotionConfig.objects.acreate(token=access_token, user=user)  # <-- Stores attacker's token\n```\n\nTo exploit is relatively easy. Once we know the victim's UUID, we simply initiate the Notion sync process on our own account and intercept the callback, replacing the `state` parameter with the victim's UUID.\n\n### Impact\nDeletes user's existing Notion sync and replaces it with attacker-controlled Notion. Could allow for index poisoning. I'm not entirely sure what Khoj does with synced files but if it's being passed as context to an LLM then I can imagine there's potential here.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "khoj"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.0.0b25.dev3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/khoj-ai/khoj/security/advisories/GHSA-6whj-7qmg-86qj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-69207"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/khoj-ai/khoj/commit/1b7ccd141d47f365edeccc57d7316cb0913d748b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/khoj-ai/khoj"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/khoj-ai/khoj/releases/tag/2.0.0-beta.23"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-639", "CWE-862" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-02T17:31:33Z",
    "nvd_published_at" : "2026-02-02T23:16:01Z"
  }
}