Skip to main content

CVE-2024-8027: Youdao QAnything Stored XSS Vulnerability

CVE-2024-8027 is a stored XSS flaw in Youdao QAnything that lets attackers upload malicious files to trigger script execution during user chats. This article covers technical details, affected versions, and mitigation steps.

Published:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-8027 Overview

CVE-2024-8027 is a stored Cross-Site Scripting (XSS) vulnerability in netease-youdao/QAnything, an open-source question-answering platform built on local knowledge bases. Attackers can upload malicious knowledge files into the knowledge base. The payload executes in a victim's browser when the user interacts with the affected content through the chat interface. The flaw is tracked under [CWE-79] (Improper Neutralization of Input During Web Page Generation) and affects all versions prior to the vendor fix.

Critical Impact

Authenticated attackers can inject persistent JavaScript into knowledge base content, hijacking chat sessions and exfiltrating data from any user who queries the poisoned knowledge.

Affected Products

  • netease-youdao/QAnything (all versions prior to the fix)
  • Youdao QAnything knowledge-base chat interface
  • Deployments ingesting user-supplied knowledge files

Discovery Timeline

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

Technical Details for CVE-2024-8027

Vulnerability Analysis

QAnything accepts user-uploaded documents and incorporates their content into a retrieval-augmented chat workflow. The application fails to neutralize HTML and JavaScript constructs embedded in uploaded knowledge files before rendering them in the chat response pane. When a user queries content that references the poisoned document, the browser parses the attacker-controlled markup as executable code.

Because the payload persists inside the knowledge base, every subsequent chat session that surfaces the tainted content re-triggers execution. This gives the vulnerability stored (persistent) XSS characteristics rather than a reflected one-shot attack. Exploitation requires an attacker able to upload a file to the knowledge base and a victim who interacts with that content through chat.

Root Cause

The root cause is missing output encoding and inadequate input sanitization in the pipeline that renders knowledge-base content inside the chat UI. Document text extracted from uploads is passed to the frontend without stripping or escaping HTML, allowing <script> tags, event handlers, and other active content to survive to the DOM.

Attack Vector

An attacker with upload permissions crafts a knowledge file containing embedded JavaScript, for example inside HTML tags, SVG elements, or markdown that renders to raw HTML. The file is ingested through the standard upload flow. When any user later issues a chat query that retrieves the malicious document fragment, the payload executes within the authenticated browser session, enabling session token theft, forced actions on behalf of the user, or redirection to attacker-controlled infrastructure.

The vulnerability is described in prose only; no verified public proof-of-concept code is published. See the Huntr Vulnerability Bounty for additional detail.

Detection Methods for CVE-2024-8027

Indicators of Compromise

  • Knowledge-base files containing <script>, onerror=, onload=, or javascript: constructs in extracted text
  • Chat responses rendering unexpected HTML entities, iframes, or external script references
  • Outbound browser requests from QAnything user sessions to unfamiliar domains following a chat query
  • Session tokens or cookies appearing in web server logs for the QAnything frontend origin

Detection Strategies

  • Scan ingested documents in the knowledge base for HTML and JavaScript patterns before indexing
  • Enable Content Security Policy (CSP) reporting on the QAnything frontend to capture inline script violations
  • Review audit logs for uploads from unexpected accounts or bulk uploads containing active content

Monitoring Recommendations

  • Alert on anomalous outbound DNS or HTTP traffic originating from user browsers during QAnything sessions
  • Monitor for new or modified knowledge-base entries outside normal change windows
  • Correlate upload events with subsequent chat query spikes targeting the same document identifiers

How to Mitigate CVE-2024-8027

Immediate Actions Required

  • Upgrade netease-youdao/QAnything to the patched release referenced in the Huntr bounty report
  • Audit the existing knowledge base for files containing HTML or JavaScript and quarantine suspicious entries
  • Restrict upload privileges to trusted accounts and require review before new documents are indexed

Patch Information

The maintainers resolved the issue in the version referenced by the Huntr disclosure. Operators should pull the latest release from the netease-youdao/QAnything repository and redeploy. No vendor advisory URL beyond the Huntr bounty page is listed in the NVD record.

Workarounds

  • Enforce a strict Content Security Policy that blocks inline scripts and restricts script sources on the QAnything web interface
  • Preprocess uploaded documents through an HTML sanitizer such as DOMPurify or Bleach before indexing
  • Disable raw HTML rendering in the chat response pane and treat retrieved document fragments as plain text
bash
# Example Content Security Policy header for the QAnything frontend
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'self'";

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.