Skip to main content

CVE-2024-6035: Chuanhuchatgpt Stored XSS Vulnerability

CVE-2024-6035 is a stored XSS flaw in Gaizhenbiao Chuanhuchatgpt that enables attackers to inject malicious scripts into chat history files. This article covers technical details, affected versions, security impact, and mitigation.

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-6035 Overview

CVE-2024-6035 is a stored cross-site scripting (XSS) vulnerability in gaizhenbiao/chuanhuchatgpt version 20240410. The flaw allows attackers to inject malicious JavaScript into chat history files. When a victim uploads a crafted chat history file, the embedded script executes in the victim's browser session. Successful exploitation can lead to session hijacking, credential theft, malware delivery, and phishing attacks against application users. The vulnerability is tracked under CWE-79 (Improper Neutralization of Input During Web Page Generation).

Critical Impact

Attackers can execute arbitrary JavaScript in a victim's browser, enabling session hijacking and theft of chat data stored in the ChuanhuChatGPT interface.

Affected Products

  • gaizhenbiao/chuanhuchatgpt version 20240410
  • Earlier builds that share the same chat history rendering logic
  • Any deployment accepting user-supplied chat history imports

Discovery Timeline

  • 2024-07-11 - CVE-2024-6035 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-6035

Vulnerability Analysis

The vulnerability is a stored XSS issue in the chat history import feature of ChuanhuChatGPT. The application accepts user-uploaded chat history files and renders their contents in the web interface without adequate output encoding. An attacker crafts a chat history file containing JavaScript payloads inside message fields. When a victim imports the file, the browser interprets the attacker-controlled markup as executable script in the application origin.

Because the payload persists inside the uploaded artifact, exploitation requires only that a target user open the malicious file. The attack vector is network-based and requires user interaction to upload the file. Full technical details are available in the Huntr Vulnerability Report.

Root Cause

The root cause is missing input sanitization and output encoding when rendering chat history content. ChuanhuChatGPT trusts the contents of imported history files and injects fields directly into the DOM. This classic [CWE-79] pattern permits HTML and script tags embedded in message content to be parsed by the browser rather than displayed as text.

Attack Vector

An attacker first creates a chat history file containing an XSS payload within a message or metadata field. The attacker distributes the file through phishing, forums, or shared workspaces. When a victim uses the import feature in ChuanhuChatGPT, the payload executes in the victim's authenticated session. The script can exfiltrate session tokens, read conversation history, and perform actions as the victim within the application.

Detection Methods for CVE-2024-6035

Indicators of Compromise

  • Uploaded chat history files containing <script>, onerror=, onload=, or javascript: sequences inside message fields
  • Unexpected outbound HTTP requests from the ChuanhuChatGPT frontend to attacker-controlled domains
  • Browser console errors or new DOM elements appearing immediately after a history import
  • Session tokens or cookies observed in web server access logs tied to referer URLs from the chat UI

Detection Strategies

  • Inspect uploaded JSON or history files server-side for HTML and JavaScript tokens before rendering
  • Enable Content Security Policy (CSP) reporting to catch inline script execution violations
  • Monitor web application firewall (WAF) logs for XSS signatures in POST requests to the import endpoint
  • Correlate file upload events with subsequent anomalous API calls from the same user session

Monitoring Recommendations

  • Log every chat history import event with user ID, file hash, and file size for later review
  • Alert when imported files contain script-like patterns or non-printable payloads
  • Track browser telemetry for CSP violation reports originating from the ChuanhuChatGPT origin
  • Review authentication logs for session reuse from unexpected IP addresses after import activity

How to Mitigate CVE-2024-6035

Immediate Actions Required

  • Restrict access to the chat history import feature until a patched release is deployed
  • Instruct users to only import chat history files from trusted sources
  • Deploy a strict Content Security Policy that forbids inline scripts and unknown origins
  • Rotate session tokens and API keys for any user suspected of importing an untrusted file

Patch Information

No vendor advisory URL is listed in the NVD record for CVE-2024-6035. Operators should monitor the gaizhenbiao/chuanhuchatgpt repository for releases superseding version 20240410 and upgrade when a fix is available. Verify commit history for sanitization changes in chat history rendering code paths before deploying.

Workarounds

  • Disable the chat history import feature in deployments that do not require it
  • Place the application behind a WAF with rules that block XSS payloads in uploads
  • Serve the application with HTTP response headers X-XSS-Protection, X-Content-Type-Options: nosniff, and a restrictive CSP
  • Isolate the ChuanhuChatGPT origin from other sensitive web applications to limit cross-origin impact
bash
# Example nginx hardening for the ChuanhuChatGPT reverse proxy
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
client_max_body_size 2m;

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.