Local file inclusion in gradio
High7.5CVE-2024-4941 · Published Jun 6, 2024 · updated Oct 16, 2025
A local file inclusion vulnerability exists in the JSON component of gradio-app/gradio and was discovered in version 4.25. The vulnerability arises from improper input validation in the `postprocess()` function within `gradio/components/json_component.py`, where a user-controlled string is parsed as JSON. If the parsed JSON object contains a `path` key, the specified file is moved to a temporary directory, making it possible to retrieve it later via the `/file=..` endpoint. This issue is due to the `processing_utils.move_files_to_cache()` function traversing any object passed to it, looking for a dictionary with a `path` key, and then copying the specified file to a temporary directory. The vulnerability can be exploited by an attacker to read files on the remote system, posing a significant security risk.
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| gradio PyPI | < 4.31.3 | 4.31.3 |
Details and references
More Gradio advisories
All Gradio| Date | Advisory | Severity | Fixed in |
|---|---|---|---|
| Jul 12024 | Gradio: code injection | Critical9.8 | No fix yet |
| Jun 222024 | Open redirect in gradio | Medium5.4 | No fix yet |
| Jun 62024 | Server-Side Request Forgery in gradio | High8.6 | No fix yet |
| Jun 42024 | Gradio: command injection | Critical9.1 | 4.29.0 |
| May 212024 | Gradio applications running locally vulnerable to 3rd party websites accessing routes and uploading files | Medium4.3 | 4.19.2 |
| May 52024 | Gradio's Component Server does not properly consider` _is_server_fn` for functions | Medium6.5 | 4.13.0 |