CVE-2024-10648
Executive Summary
CVE-2024-10648 is a high-severity path traversal vulnerability (CVSS 8.2) discovered in the Gradio Audio component of the gradio-app/gradio project, specifically in commit 98cbcae. The flaw allows an unauthenticated attacker to control the output format of an audio file, leading to arbitrary file content deletion. By manipulating the format parameter, an attacker can reset any file on the server to an empty state, causing a denial of service (DoS). This vulnerability is particularly dangerous because it requires no authentication and can be exploited remotely over the network. As of this report, no official patch has been released, and no public proof-of-concept (PoC) code is available.
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
Gradio is a popular Python library for building machine learning demos and web applications, distributed via PyPI. This vulnerability affects the core library itself, not a dependency. Users of Gradio who expose the Audio component to untrusted input are at risk. The lack of a patch means that supply chain security is compromised for all versions containing this commit. Organizations should monitor the official Gradio repository for updates and consider temporary mitigations.
CVSS Breakdown & Threat Level
- CVSS Score: 8.2 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H
- Attack Vector: Network (AV:N) – Exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required.
- Scope: Unchanged (S:U) – The vulnerable component and the impacted component are the same.
- Confidentiality Impact: None (C:N) – No data exposure.
- Integrity Impact: Low (I:L) – File content can be reset to empty, but not modified arbitrarily.
- Availability Impact: High (A:H) – Denial of service via file deletion.
Threat Level: High. The vulnerability is easy to exploit, requires no privileges, and can cause significant disruption by deleting critical files.
Deep Dive & Mechanics
The vulnerability resides in the Gradio Audio component's file handling logic. When processing audio files, the component allows the user to specify the output format (e.g., wav, mp3, flac). The flaw is that the format parameter is not properly sanitized, allowing path traversal sequences (e.g., ../) to be injected. This enables an attacker to control the destination path of the file write operation.
The attack works as follows:
- The attacker sends a crafted request to the Gradio server with a malicious
formatparameter containing path traversal sequences. - The server constructs a file path using the attacker-controlled format, leading to an arbitrary location on the filesystem.
- The server then writes an empty audio file (or resets the content) to that location, effectively deleting the original file's content.
This is a classic path traversal vulnerability (CWE-22) combined with a file write operation. The impact is limited to file content reset (integrity) and denial of service (availability), as the attacker cannot read or modify arbitrary data.
Vulnerable vs. Patched Code
Since no official patch exists, we can only analyze the vulnerable code pattern. The vulnerable code likely resembles:
# Vulnerable code (conceptual)
def process_audio(input_file, format):
output_path = f"/tmp/audio_{format}.{format}" # format is user-controlled
with open(output_path, 'w') as f:
f.write("") # reset file content
return output_path
A patched version would sanitize the format parameter:
# Patched code (conceptual)
import os
import re
def process_audio(input_file, format):
# Sanitize format to allow only alphanumeric and dots
if not re.match(r'^[a-zA-Z0-9.]+$', format):
raise ValueError("Invalid format")
output_path = f"/tmp/audio_{format}.{format}"
# Ensure path is within allowed directory
output_path = os.path.normpath(output_path)
if not output_path.startswith("/tmp/"):
raise ValueError("Path traversal detected")
with open(output_path, 'w') as f:
f.write("")
return output_path
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Deploy a vulnerable Gradio instance using commit
98cbcae:git clone https://github.com/gradio-app/gradio.git cd gradio git checkout 98cbcae pip install -e . python -c "import gradio as gr; gr.Interface(fn=lambda x: x, inputs=gr.Audio(), outputs=gr.Audio()).launch()" - The server will be available at
http://localhost:7860.
Exploitation Steps:
- Identify the Audio component endpoint (e.g.,
/api/predict/). - Craft a POST request with a malicious
formatparameter:curl -X POST http://localhost:7860/api/predict/ \ -H "Content-Type: application/json" \ -d '{"data": [{"name": "test.wav", "data": "base64_encoded_audio"}], "format": "../../etc/passwd"}' - This will attempt to reset the
/etc/passwdfile to empty, causing a DoS.
Note: No public exploit code is available. The above is a conceptual demonstration.
Blue Team (Defensive)
Detection:
- Monitor for requests to Gradio endpoints with unusual
formatparameters containing../or..\\. - Alert on file write operations to sensitive directories (e.g.,
/etc,/var/www).
Mitigation:
- Implement input validation for the
formatparameter (allow only alphanumeric and dots). - Use a whitelist of allowed formats.
- Apply the principle of least privilege to the Gradio process (e.g., run as a non-root user with limited write permissions).
- Deploy a Web Application Firewall (WAF) with rules to block path traversal attempts.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to Gradio endpoints with
formatparameter containing../or..\\. - Unusual file write operations to non-standard paths (e.g.,
/etc,/var/log).
- HTTP requests to Gradio endpoints with
- File System IOCs:
- Empty files in unexpected locations (e.g.,
/etc/passwdwith zero size). - Log entries showing file write errors to sensitive paths.
- Empty files in unexpected locations (e.g.,
- Process IOCs:
- Gradio process attempting to write to files outside its working directory.
Detection Engineering
YARA Rule
rule CVE_2024_10648_Gradio_Path_Traversal {
meta:
description = "Detects path traversal attempts in Gradio Audio component"
author = "Valters IT"
date = "2024-01-01"
cve = "CVE-2024-10648"
strings:
$traversal1 = "../"
$traversal2 = "..\\"
$format_param = "format"
condition:
any of ($traversal*) and $format_param
}
Sigma Rule
title: Gradio Audio Path Traversal Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects path traversal attempts targeting Gradio Audio component
author: Valters IT
date: 2024-01-01
logsource:
category: webserver
product: gradio
detection:
selection:
http.method: POST
http.url|contains: "/api/predict/"
http.body|contains:
- "../"
- "..\\"
condition: selection
falsepositives:
- Legitimate use of dots in format names (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-10648 Gradio Audio Path Traversal Attempt"; flow:to_server; content:"POST"; http_method; content:"/api/predict/"; http_uri; content:"../"; http_client_body; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the Audio component if not essential, or restrict access to trusted users only.
- Apply input validation on the
formatparameter to allow only safe characters (e.g.,[a-zA-Z0-9._-]). - Run Gradio with minimal privileges – use a dedicated non-root user and restrict write permissions to only necessary directories.
- Deploy a WAF with rules to block path traversal patterns.
Long-term Fix:
- Monitor the official Gradio repository for a patch. Once available, update to the patched version immediately.
- Consider forking the project and applying the fix yourself if the vendor is unresponsive.
Workaround:
- Use a reverse proxy (e.g., Nginx) to filter requests containing path traversal sequences before they reach Gradio.
Valters IT