Skip to content

Commit 58e8478

Browse files
1 parent 3779848 commit 58e8478

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-6whj-7qmg-86qj",
4+
"modified": "2026-02-02T17:31:33Z",
5+
"published": "2026-02-02T17:31:33Z",
6+
"aliases": [
7+
"CVE-2025-69207"
8+
],
9+
"summary": "Khoj has an IDOR in Notion OAuth Flow that Enables Index Poisoning",
10+
"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.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "PyPI",
21+
"name": "khoj"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"last_affected": "2.0.0b25.dev3"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/khoj-ai/khoj/security/advisories/GHSA-6whj-7qmg-86qj"
42+
},
43+
{
44+
"type": "PACKAGE",
45+
"url": "https://github.com/khoj-ai/khoj"
46+
}
47+
],
48+
"database_specific": {
49+
"cwe_ids": [
50+
"CWE-862"
51+
],
52+
"severity": "MODERATE",
53+
"github_reviewed": true,
54+
"github_reviewed_at": "2026-02-02T17:31:33Z",
55+
"nvd_published_at": null
56+
}
57+
}

0 commit comments

Comments
 (0)