CVE-2024-4321 Overview
CVE-2024-4321 is a Local File Inclusion (LFI) vulnerability in the gaizhenbiao/chuanhuchatgpt application. The flaw resides in the chat history upload functionality of version 20240310. The application fails to properly validate file paths supplied through the name parameter during upload requests. An unauthenticated remote attacker can manipulate this parameter to read arbitrary files on the server. Successful exploitation results in disclosure of sensitive server-side data, including API keys and private user information. The vulnerability is classified under [CWE-20] Improper Input Validation.
Critical Impact
Unauthenticated attackers can read arbitrary files on the server, exposing API keys, configuration data, and other sensitive information.
Affected Products
- gaizhenbiao/chuanhuchatgpt version 20240310
Discovery Timeline
- 2024-05-16 - CVE-2024-4321 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-4321
Vulnerability Analysis
The vulnerability exists in the chat history upload handler of chuanhuchatgpt. The handler accepts a name parameter that specifies the file to process during the upload workflow. The application concatenates this user-controlled value into a file system path without sanitization or canonicalization. Attackers can supply path traversal sequences such as ../ or absolute paths in the name parameter to reference files outside the intended chat history directory.
The attack requires no authentication and no user interaction. An attacker intercepts a legitimate upload request, replaces the name value with a target file path, and forwards the request. The application returns the contents of the referenced file in its response.
Exposed data typically includes application configuration files, private conversation histories, and stored API keys for downstream LLM providers. Attackers who harvest API keys can pivot to abuse third-party AI services under the victim's account.
Root Cause
The root cause is improper input validation [CWE-20] on the name parameter. The upload endpoint treats the parameter as a trusted file identifier rather than untrusted user input. No allowlist, path canonicalization, or containment check limits the value to the designated chat history directory.
Attack Vector
The attack vector is network-based. An attacker sends a crafted HTTP request to the chat history upload endpoint with a manipulated name parameter pointing to a target file. See the Huntr Bounty Report for reproduction details.
Detection Methods for CVE-2024-4321
Indicators of Compromise
- HTTP requests to chat history upload endpoints containing ../, ..\, or absolute file paths in the name parameter
- Application responses returning content from files outside the expected chat history directory
- Access log entries referencing sensitive files such as /etc/passwd, .env, or API key stores originating from the chuanhuchatgpt process
- Unexpected outbound API calls using leaked provider keys after suspicious upload activity
Detection Strategies
- Inspect web server and reverse proxy logs for path traversal sequences in POST bodies targeting chuanhuchatgpt upload routes
- Deploy web application firewall rules that block traversal patterns in the name parameter
- Monitor file access telemetry on the host running chuanhuchatgpt for reads of sensitive files by the application process
Monitoring Recommendations
- Enable verbose HTTP request logging on the chuanhuchatgpt instance and forward logs to a centralized analytics platform
- Alert on any process-level file reads outside the designated chat history directory
- Track anomalous usage patterns on downstream LLM API keys that could indicate credential theft
How to Mitigate CVE-2024-4321
Immediate Actions Required
- Upgrade chuanhuchatgpt beyond version 20240310 to a release that patches the LFI issue
- Rotate any API keys, tokens, and credentials stored on hosts running the vulnerable version
- Restrict network exposure of the chuanhuchatgpt web interface to trusted networks or authenticated users only
- Audit access logs for prior exploitation attempts referencing the name parameter
Patch Information
Refer to the project maintainers at the gaizhenbiao/chuanhuchatgpt repository for updated releases. The Huntr Bounty Report provides additional remediation context.
Workarounds
- Place chuanhuchatgpt behind a reverse proxy with WAF rules that reject path traversal sequences in request bodies
- Run the application under a low-privilege system account with filesystem access limited to its working directory
- Isolate the application in a container with read-only mounts for the host filesystem
- Remove or relocate sensitive configuration files and API keys from directories accessible to the application process
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

