{"id":"CVE-2025-69207","aliases":["CVE-2025-69207","GHSA-6whj-7qmg-86qj","PYSEC-2026-1491"],"related":[],"kind":"vulnerability","state":"published","title":"Khoj has an IDOR in Notion OAuth Flow Enables Index Poisoning","summary":"Khoj is a self-hostable artificial intelligence app. Prior to 2.0.0-beta.23, 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. This vulnerability is fixed in 2.0.0-beta.23.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Khoj is a self-hostable artificial intelligence app. Prior to 2.0.0-beta.23, 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. This vulnerability is fixed in 2.0.0-beta.23.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Khoj es una aplicación de inteligencia artificial autoalojable. Antes de la 2.0.0-beta.23, una IDOR en la devolución de llamada de OAuth de Notion permite a un atacante secuestrar la integración de Notion de cualquier usuario manipulando el parámetro state. El endpoint de devolución de llamada acepta cualquier UUID de usuario sin verificar que el flujo de OAuth fue iniciado por ese usuario, permitiendo a los atacantes reemplazar las configuraciones de Notion de las víctimas con las suyas propias, lo que resulta en envenenamiento de datos y acceso no autorizado al índice de búsqueda de Khoj de la víctima. Este ataque requiere conocer el UUID del usuario, que puede filtrarse a través de conversaciones compartidas donde una imagen generada por IA está presente. Esta vulnerabilidad está corregida en la 2.0.0-beta.23.","source":"nvd"}],"published":"2026-02-02T17:31:33.000Z","modified":"2026-07-07T17:57:14.355Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L","score":5.4,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L","score":5.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L","score":5.4,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:H/A:N","score":7.1,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L","score":5.4,"rating":"MEDIUM"}],"cwes":["CWE-639","CWE-862"],"affected":[{"ranges":[{"version":"< 2.0.0-beta.23","status":"affected"}],"vendor":"khoj-ai","product":"khoj","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"2.0.0b25.dev3"}],"ecosystem":"PyPI","package":"khoj","purl":"pkg:pypi/khoj","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"},{"status":"affected","version":"2.0.0"}],"vendor":"khoj","product":"khoj","cpe":"cpe:2.3:a:khoj:khoj:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"2.0.0b25.dev3"}],"ecosystem":"PyPI","package":"khoj","purl":"pkg:pypi/khoj","source":"pysec"}],"references":[{"url":"https://github.com/khoj-ai/khoj/security/advisories/GHSA-6whj-7qmg-86qj","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/khoj-ai/khoj/commit/1b7ccd141d47f365edeccc57d7316cb0913d748b","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/khoj-ai/khoj/releases/tag/2.0.0-beta.23","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-69207","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/khoj-ai/khoj","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/khoj","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-6whj-7qmg-86qj","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-02-03T15:44:16.914Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-69207","url":"https://www.cve.org/CVERecord?id=CVE-2025-69207","licence":"CVE Terms of Use","modified":"2026-02-03T15:45:38.393Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-6whj-7qmg-86qj","url":"https://github.com/advisories/GHSA-6whj-7qmg-86qj","licence":"CC-BY-4.0","modified":"2026-07-07T17:57:14.355Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-69207","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-69207","licence":"Public domain","modified":"2026-06-17T10:00:17.293Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1491","url":"https://osv.dev/vulnerability/PYSEC-2026-1491","licence":"CC-BY-4.0","modified":"2026-07-07T17:46:35.276Z"}],"updatedAt":"2026-11-25T22:59:10.988Z","epss":{"score":0.00414,"percentile":0.37772,"date":"2026-12-01T12:00:22.000Z"}}