Skip to main content
CVE Vulnerability Database

CVE-2024-7819: Danswer CORS Information Disclosure Flaw

CVE-2024-7819 is a CORS misconfiguration in Danswer v1.4.1 that allows attackers to steal chat contents, API keys, and sensitive data through improper origin validation. This article covers technical details, impact, and mitigation.

Published:

CVE-2024-7819 Overview

CVE-2024-7819 is a Cross-Origin Resource Sharing (CORS) misconfiguration affecting danswer-ai/danswer version 1.4.1. The application improperly validates the Origin header, allowing malicious web pages to issue cross-origin requests against the Danswer API. Attackers can exfiltrate sensitive data including chat contents, API keys, and other user information when a victim visits an attacker-controlled page while authenticated to Danswer. The flaw is categorized under [CWE-346] Origin Validation Error.

Critical Impact

An attacker-controlled web page can read authenticated API responses from Danswer, exposing chat history, API keys, and other confidential data belonging to the victim user.

Affected Products

  • danswer-ai/danswer v1.4.1
  • Earlier versions sharing the same CORS handler are potentially affected
  • Deployments exposing the Danswer API to browser-based clients

Discovery Timeline

  • 2025-03-20 - CVE-2024-7819 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-7819

Vulnerability Analysis

The vulnerability stems from improper validation of the HTTP Origin header in the Danswer application. When a browser sends a cross-origin request, the server reflects or accepts arbitrary origins rather than restricting responses to a trusted allowlist. This behavior, combined with Access-Control-Allow-Credentials: true, permits attacker-hosted pages to read authenticated responses.

Exploitation requires user interaction, as reflected by the attack vector requiring a victim to visit a malicious page while holding a valid Danswer session. Because credentials are included, the browser attaches the victim's session cookies to cross-origin XHR or fetch calls. The server then returns sensitive payloads that the malicious origin can parse.

The scope change indicates that a compromise of the browser-based client boundary yields impact on the Danswer backend's confidential data. Impact is limited to confidentiality; integrity and availability remain unaffected.

Root Cause

The root cause is an insufficient origin allowlist in the CORS middleware. The server treats untrusted origins as valid, either through a wildcard reflection pattern or a permissive regular expression. Origin validation should compare inbound Origin values against a strict allowlist of trusted front-end URLs.

Attack Vector

An attacker crafts a web page containing JavaScript that issues fetch requests to Danswer endpoints such as chat history or API key retrieval, with credentials: 'include'. When the victim visits this page while authenticated, the browser attaches session cookies. The Danswer server responds with sensitive data and permissive CORS headers, allowing the attacker's script to read and exfiltrate the response.

The vulnerability mechanism is described in prose only; no verified proof-of-concept code has been published. See the Huntr Bug Bounty Listing for additional technical context.

Detection Methods for CVE-2024-7819

Indicators of Compromise

  • Unexpected outbound API calls to Danswer endpoints originating from browsers on non-corporate domains
  • HTTP responses from Danswer containing Access-Control-Allow-Origin values matching untrusted external domains
  • Access logs showing Origin headers referencing domains outside the organization's approved list
  • Unusual bulk retrieval of chat contents or API key endpoints tied to a single session token

Detection Strategies

  • Inspect Danswer HTTP response headers for reflective CORS behavior, specifically Access-Control-Allow-Origin echoing arbitrary values with Access-Control-Allow-Credentials: true
  • Deploy web application firewall rules that flag preflight OPTIONS requests carrying unusual Origin values
  • Correlate authentication events with subsequent cross-origin API calls to identify session abuse patterns

Monitoring Recommendations

  • Log all Origin and Referer headers on Danswer API endpoints and alert on values outside the approved allowlist
  • Monitor egress traffic from user endpoints for POSTs to external domains carrying Danswer response payloads
  • Track access patterns to sensitive endpoints such as /api/chat and API key management routes for anomalous request volumes

How to Mitigate CVE-2024-7819

Immediate Actions Required

  • Upgrade danswer-ai/danswer beyond version 1.4.1 to a release containing the CORS fix
  • Restrict the CORS allowlist in application configuration to only trusted front-end origins
  • Rotate any Danswer API keys and user session tokens that may have been exposed
  • Audit access logs for suspicious Origin header values indicating prior exploitation attempts

Patch Information

Refer to the Huntr Bug Bounty Listing for remediation details from the maintainers. Users should track the danswer-ai/danswer repository for the fixed release and apply the update promptly.

Workarounds

  • Place Danswer behind a reverse proxy that strips permissive Access-Control-Allow-Origin response headers and enforces a strict allowlist
  • Set SameSite=Strict on session cookies to prevent browsers from attaching credentials to cross-origin requests
  • Deploy Content Security Policy (CSP) headers on trusted front-end applications to reduce attacker script execution surface
bash
# Example nginx configuration enforcing a strict CORS allowlist
map $http_origin $cors_ok {
    default "";
    "https://danswer.example.com" $http_origin;
}

server {
    location /api/ {
        if ($cors_ok = "") { return 403; }
        add_header Access-Control-Allow-Origin $cors_ok always;
        add_header Access-Control-Allow-Credentials "true" always;
        add_header Vary "Origin" always;
        proxy_pass http://danswer_backend;
    }
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.