High

gradio

Arbitrary Local File Read in Gradio via Component Method Invocation

A vulnerability in Gradio version 4.12.0 allows attackers to read arbitrary files on the server by exploiting the `/component_server` endpoint to call any method on a `Component` class, specifically `move_resource_to_block_cache()`. This issue was patched in version 4.13.0.

Available publicly on Apr 16 2024

7.5

CVSS:

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Credit:

ozelis
Threat Overview

The vulnerability stems from the ability to call any method on a Component class through the /component_server endpoint without proper validation of the method being called or the arguments passed. An attacker can exploit this by invoking the move_resource_to_block_cache() method of the Block class, which Component inherits from, to copy any file from the filesystem to a temporary directory and retrieve it via the /file={path} endpoint. This could lead to the exposure of sensitive information stored on the server.

Attack Scenario

An attacker first identifies a running Gradio application, then sends a crafted request to the /component_server endpoint specifying the move_resource_to_block_cache function name and the path to a sensitive file (e.g., /etc/passwd) as arguments. The server executes this request, resulting in the specified file being copied to a temporary directory. The attacker then sends another request to retrieve the file from the temporary directory, gaining unauthorized access to its contents.

Who is affected

Any server running an unpatched version of Gradio (specifically version 4.12.0) is vulnerable to this attack. This includes individual developers, organizations, and services hosting Gradio applications, such as those on huggingface.co, potentially exposing sensitive information like environment variables, API tokens, and credentials.

Technical Report
Want more out of Sightline?

Sightline offers even more for premium customers

Go Premium

We have - related security advisories that are available with Sightline Premium.