CVE-2024-6090 Overview
CVE-2024-6090 is a path traversal vulnerability [CWE-22] in gaizhenbiao/chuanhuchatgpt version 20240410. The flaw allows any authenticated user to delete other users' chat histories by manipulating file path parameters. Attackers can extend the attack to delete arbitrary files ending in .json on the host filesystem. Deleting authentication-related JSON files renders the application unusable and prevents users from logging in, producing a denial-of-service condition.
ChuanhuChatGPT is an open-source web interface for large language model interactions. The vulnerability resides in history file handling routines within modules/models/base_model.py and modules/utils.py.
Critical Impact
Unauthenticated network-accessible attackers can destroy arbitrary .json files, causing loss of user chat data and denial of service through deletion of authentication configuration files.
Affected Products
- gaizhenbiao/chuanhuchatgpt version 20240410
- Prior versions containing the unpatched history save/delete routines
- Deployments without the 526c615c security patch applied
Discovery Timeline
- 2024-06-27 - CVE-2024-6090 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-6090
Vulnerability Analysis
The vulnerability originates from insufficient validation of user-supplied filenames passed to history save and delete functions. The application constructs history file paths by joining a base directory with a user-controlled filename without confirming that the resulting path stays within the requesting user's directory. Attackers can supply relative path traversal sequences such as ../ in the filename parameter to escape the intended user directory.
When the delete routine executes os.remove() on the constructed path, it removes files belonging to other users or unrelated system files. The impact is bounded to files with .json and .md extensions because the code appends these suffixes when computing paths. Deleting user configuration JSON files disrupts authentication, causing users to be unable to sign in.
Root Cause
The root cause is missing directory containment checks in the file path assembly logic. The code trusted that os.path.dirname(history_file_path) would equal the authenticated user_name, but never asserted this invariant before file operations. Any traversal payload changed the directory component without triggering a security check.
Attack Vector
Exploitation requires network access to the ChuanhuChatGPT web interface. An attacker submits a crafted request to the history delete endpoint with a filename containing traversal sequences targeting another user's directory or a system-level .json file. No user interaction is required beyond the malicious request itself.
# Security patch in modules/models/base_model.py
# Source: https://github.com/gaizhenbiao/chuanhuchatgpt/commit/526c615c437377ee9c71f866fd0f19011910f705
else:
history_file_path = filename
md_history_file_path = history_file_path[:-5] + ".md"
+ # check if history file path matches user_name
+ # if user access control is not enabled, user_name is empty, don't check
+ assert os.path.dirname(history_file_path) == self.user_name or self.user_name == ""
+ assert os.path.dirname(md_history_file_path) == self.user_name or self.user_name == ""
try:
os.remove(history_file_path)
os.remove(md_history_file_path)
The patch adds explicit assertions that verify the directory portion of the resolved path matches the authenticated username before any destructive file operation executes.
# Security patch in modules/utils.py
# Source: https://github.com/gaizhenbiao/chuanhuchatgpt/commit/526c615c437377ee9c71f866fd0f19011910f705
else:
history_file_path = os.path.join(HISTORY_DIR, user_name, filename)
+ # check if history file path matches user_name
+ # if user access control is not enabled, user_name is empty, don't check
+ assert os.path.dirname(history_file_path) == model.user_name or model.user_name == ""
with open(history_file_path, "w", encoding="utf-8") as f:
json.dump(json_s, f, ensure_ascii=False, indent=4)
Detection Methods for CVE-2024-6090
Indicators of Compromise
- Unexpected deletion of .json or .md files inside the ChuanhuChatGPT history/ directory tree
- Web server access logs showing filename parameters containing ../ or URL-encoded %2e%2e%2f sequences
- Authentication failures for multiple users following file deletion events
- File modification timestamps on user history directories inconsistent with legitimate user activity
Detection Strategies
- Inspect HTTP request bodies and query strings sent to history endpoints for traversal patterns targeting filename fields
- Correlate file deletion events on the host with the process identity of the ChuanhuChatGPT service
- Alert on removal of authentication or configuration .json files under the application working directory
Monitoring Recommendations
- Enable filesystem auditing (auditd on Linux) on the ChuanhuChatGPT installation directory to record unlink operations
- Forward web application access logs to a central log platform and build queries for path traversal signatures
- Monitor for spikes in HTTP 500 responses or authentication errors that may indicate a successful attack
How to Mitigate CVE-2024-6090
Immediate Actions Required
- Upgrade ChuanhuChatGPT to a version that includes commit 526c615c437377ee9c71f866fd0f19011910f705 or later
- Restrict network access to the ChuanhuChatGPT web interface using a reverse proxy with authentication
- Back up the history/ directory and any application configuration JSON files before further exposure
- Review filesystem for missing or recently deleted .json files and restore from backup where necessary
Patch Information
The official fix is documented in the GitHub Commit: Security Update and the Huntr Bounty Disclosure. The patch adds assert os.path.dirname(history_file_path) == self.user_name guards in modules/models/base_model.py and modules/utils.py before every file save and delete operation.
Workarounds
- Deploy the application inside a container with a read-only filesystem for directories outside the history path
- Run ChuanhuChatGPT under a dedicated low-privilege user account restricted to the history directory
- Place the application behind a web application firewall configured to block traversal sequences such as ../ and ..%2f in request parameters
- Disable public access and require VPN or SSO authentication in front of the interface until patching is complete
# Configuration example: apply the upstream security patch
cd /opt/chuanhuchatgpt
git fetch origin
git checkout 526c615c437377ee9c71f866fd0f19011910f705 -- \
modules/models/base_model.py \
modules/utils.py
# Restart the service to load the patched modules
systemctl restart chuanhuchatgpt
# Verify the assertions are present in the deployed code
grep -n "os.path.dirname(history_file_path)" modules/models/base_model.py modules/utils.py
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

