CVE-2024-1561 Arbitrary Local File Read via Component Method Invocation in gradio-app/gradio

High 7.5 Published Updated

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.

PackageAffectedFixed in
gradio PyPIAll versions4.13.0
gradio PyPIAll versions4.13.0
gradio PyPIAll versions4.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.

All Gradio Project Gradio vulnerabilities

Sources

Also known as CVE-2024-34511, GHSA-g9cj-cfpp-4g2x, PYSEC-2026-1415.

Is CVE-2024-1561 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free