CVE-2024-1561 Arbitrary Local File Read via Component Method Invocation in gradio-app/gradio
Attackers can read arbitrary local files via the component server endpoint, exposing sensitive data like API keys.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-1561?
CVE-2024-1561 is a high-severity path traversal vulnerability in Gradio Project Gradio, published on 16 Apr 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
An issue was discovered in gradio-app/gradio, where the `/component_server` endpoint improperly allows the invocation of any method on a `Component` class with attacker-controlled arguments. Specifically, by exploiting the `move_resource_to_block_cache()` method of the `Block` class, an attacker can copy any file on the filesystem to a temporary directory and subsequently retrieve it. This vulnerability enables unauthorized local file read access, posing a significant risk especially when the application is exposed to the internet via `launch(share=True)`, thereby allowing remote attackers to read files on the host machine. Furthermore, gradio apps hosted on `huggingface.co` are also affected, potentially leading to the exposure of sensitive information such as API keys and credentials stored in environment variables.
Weakness: CWE-29
Which versions are affected by CVE-2024-1561?
3 open source packages ship an affected version, including gradio. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
gradio PyPI | All versions | 4.13.0 |
gradio PyPI | All versions | 4.13.0 |
gradio PyPI | All versions | 4.13.0 |
Products include Gradio Project Gradio.
How do I fix CVE-2024-1561?
Upgrade gradio to 4.13.0 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2024-1561 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-1561 exists.
Public exploit code: 1 Nuclei template and 4 proofs of concept on GitHub.
Other vulnerabilities in Gradio Project Gradio
- CVE-2024-39236 Withdrawn Advisory: Gradio was discovered to contain a code injection vulnerability via the component /gradio/component_meta.py
- CVE-2023-6572 Command Injection in gradio-app/gradio
- CVE-2022-24770 Improper Neutralization of Formula Elements in a CSV File in Gradio Flagging
- CVE-2026-49119 Gradio < 6.16.0 Path Traversal via FileExplorer.preprocess()
- CVE-2025-23042 Gradio Blocked Path ACL Bypass Vulnerability
Sources
Also known as CVE-2024-34511, GHSA-g9cj-cfpp-4g2x, PYSEC-2026-1415.