gradio vulnerable to Path Traversal
The `/component_server` endpoint in Gradio allows an attacker to invoke any method on a `Component` class with controlled arguments. By abusing the `move_resource_to_block_cache()` method, an attacker can copy arbitrary files to a temporary directory and retrieve them, enabling local file read.
gradio-app/gradio
Originally disclosed on huntr
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.
From the GitHub Advisory Database (GHSA-g9cj-cfpp-4g2x, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the `/component_server` endpoint fails to restrict which methods can be invoked and with what arguments, allowing attacker-controlled calls to sensitive methods like `move_resource_to_block_cache()`.
Impact
An attacker could read arbitrary files on the host, potentially exposing sensitive information such as API keys and credentials, especially when the app is exposed via `launch(share=True)` or hosted on Hugging Face.
What the attacker needed
Gradio app accessible to attacker; app exposed via launch(share=True) or hosted
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Gradio is a tool for building web apps for machine learning. A part of the app let anyone call internal functions with their own inputs, and one of those functions could copy any file on the server to a place the attacker could download it. This means someone could read private files like passwords or API keys stored on the server.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.