CVE-2024-8027

6.1 MEDIUM

📋 TL;DR

A stored Cross-Site Scripting vulnerability in netease-youdao/QAnything allows attackers to upload malicious knowledge files that execute arbitrary JavaScript when users interact with the chat interface. This affects all users of QAnything versions prior to the fix, potentially compromising their sessions and data.

💻 Affected Systems

Products:
  • netease-youdao/QAnything
Versions: All versions prior to the fix
Operating Systems: All platforms running QAnything
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in the knowledge base file upload functionality that doesn't properly sanitize content before rendering in chat.

📦 What is this software?

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could steal session cookies, redirect users to malicious sites, perform actions on behalf of authenticated users, or install malware through the chat interface.

🟠

Likely Case

Session hijacking, credential theft, and unauthorized actions within the QAnything application by authenticated users who interact with poisoned knowledge files.

🟢

If Mitigated

Limited impact with proper input validation and output encoding, though stored XSS could still affect users who access malicious content.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires file upload access to the knowledge base, but the XSS payload execution is straightforward once uploaded.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Check the huntr.com reference for specific fixed version

Vendor Advisory: https://huntr.com/bounties/cf75f024-3d64-416d-adfe-c4255d7c3f34

Restart Required: Yes

Instructions:

1. Update QAnything to the latest patched version. 2. Restart the QAnything service. 3. Verify that file uploads are properly sanitized.

🔧 Temporary Workarounds

Disable knowledge base uploads

all

Temporarily disable file upload functionality to the knowledge base until patching is complete.

Modify QAnything configuration to restrict file upload permissions

Implement WAF rules

all

Add web application firewall rules to detect and block XSS payloads in file uploads.

Configure WAF to inspect Content-Type and file content for script tags and JavaScript patterns

🧯 If You Can't Patch

  • Implement strict Content Security Policy (CSP) headers to restrict script execution
  • Enable file upload validation that rejects files containing HTML/JavaScript content

🔍 How to Verify

Check if Vulnerable:

Test by uploading a knowledge file containing <script>alert('XSS')</script> and checking if it executes during chat interactions.

Check Version:

Check QAnything version in application settings or via package manager (e.g., pip show qanything)

Verify Fix Applied:

Attempt the same XSS test after patching - the script should be properly sanitized and not execute.

📡 Detection & Monitoring

Log Indicators:

  • Unusual file uploads to knowledge base
  • Chat interactions triggering JavaScript errors
  • Multiple failed upload attempts with script-like content

Network Indicators:

  • HTTP requests containing script tags in file uploads
  • Unusual outbound connections from chat interface

SIEM Query:

source="qanything" AND (file_upload="*.txt" OR file_upload="*.pdf") AND content CONTAINS "<script>"

🔗 References

📤 Share & Export