CVE-2025-48889: Gradio Allows Unauthorized File Copy via Path Manipulation
5.3
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
gradio | pip | < 5.31.0 | 5.31.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability (GHSA-8jw3-6x8j-v96g) allows arbitrary file copying in Gradio's flagging feature due to insufficient path validation. The user-controlled path
parameter, sent via a JSON payload to the /gradio_api/run/predict
endpoint, is used by the gradio.components.file.FileData._copy_to_dir
method in a shutil.copy
operation without proper sanitization. This is the direct sink of the vulnerability.
The gradio.blocks.Blocks.preprocess_data
function is a crucial part of the execution flow. It handles the data from API requests. In vulnerable versions, this function did not adequately ensure that the user-supplied file path was validated before being processed by the FileData
component. The fix, identified in commit 40997002090b0ad7cd1037872523dcdd9bf45bc3
, was applied to Blocks.preprocess_data
. This patch ensures that data validation (specifically data_model.model_validate
) is performed for components like FileData
, thus preventing the malicious path from reaching FileData._copy_to_dir
unvalidated.
Therefore, gradio.components.file.FileData._copy_to_dir
is the function containing the vulnerable shutil.copy
operation, and gradio.blocks.Blocks.preprocess_data
is the higher-level function that, prior to the patch, failed to prevent unvalidated paths from being processed, making it a key part of the vulnerable pathway. Both functions would likely appear in a runtime profile during the exploitation of this vulnerability.