Unrestricted File Upload Leading to RCE
A file upload vulnerability was identified in the chat application 'gaizhenbiao/chuanhuchatgpt', affecting the latest version as of 20240310. The vulnerability arises from the lack of sanitization of file names and content types during the upload process, allowing for the execution of arbitrary code or XSS payloads. This issue has not yet been patched.
Available publicly on May 24 2024
Threat Overview
The vulnerability is present in the handle_file_upload
function, which fails to sanitize or validate the file names, content types, or file extensions of uploaded files. This oversight allows attackers to upload files with malicious payloads, including HTML files containing XSS payloads and Python files potentially leading to Remote Code Execution (RCE). The lack of input validation and sanitization mechanisms in the file upload feature poses a significant security risk, as it can be exploited to execute arbitrary code on the server or to perform cross-site scripting (XSS) attacks.
Attack Scenario
An attacker can exploit this vulnerability by crafting a malicious file with a dangerous type, such as an HTML file containing an XSS payload or a Python file designed to execute arbitrary code. The attacker then changes the file name and extension to bypass any rudimentary checks and uploads it to the vulnerable endpoint. Once uploaded, the malicious file can be executed under certain conditions, leading to potential XSS attacks or RCE on the server hosting the chat application.
Who is affected
Users of the 'gaizhenbiao/chuanhuchatgpt' chat application, specifically those using the version released on 20240310, are at risk. This includes administrators of the application who may unknowingly host the vulnerable software, as well as end-users who could be subjected to XSS attacks or other malicious activities facilitated by the exploitation of this vulnerability.
Technical Report
Want more out of Sightline?
Sightline offers even more for premium customers
Go Premium
We have - related security advisories that are available with Sightline Premium.