Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1qMmpnLWZxNjItN2MzaM4ABDT6
Gradio Blocked Path ACL Bypass Vulnerability
Summary
Gradio's Access Control List (ACL) for file paths can be bypassed by altering the letter case of a blocked file or directory path. This vulnerability arises due to the lack of case normalization in the file path validation logic. On case-insensitive file systems, such as those used by Windows and macOS, this flaw enables attackers to circumvent security restrictions and access sensitive files that should be protected.
This issue can lead to unauthorized data access, exposing sensitive information and undermining the integrity of Gradio's security model. Given Gradio's popularity for building web applications, particularly in machine learning and AI, this vulnerability may pose a substantial threat if exploited in production environments.
Affected Version
Gradio <= 5.6.0
Impact
-
Unauthorized Access: Sensitive files or directories specified in
blocked_paths
can be accessed by attackers. -
Data Exposure: Critical files, such as configuration files or user data, may be leaked.
-
Security Breach: This can lead to broader application or system compromise if sensitive files contain credentials or API keys.
Root Cause
The blocked_paths
parameter in Gradio block's initial configuration is designed to restrict user access to specific files or directories in the local file system. However, it does not account for case-insensitive operating systems, such as Windows and macOS. This oversight enables attackers to bypass ACL restrictions by changing the case of file paths.
Vulnerable snippet:
# https://github.com/gradio-app/gradio/blob/main/gradio/utils.py#L1500-L1517
def is_allowed_file(
path: Path,
blocked_paths: Sequence[str | Path],
allowed_paths: Sequence[str | Path],
created_paths: Sequence[str | Path],
) -> tuple[
bool, Literal["in_blocklist", "allowed", "created", "not_created_or_allowed"]
]:
in_blocklist = any(
is_in_or_equal(path, blocked_path) for blocked_path in blocked_paths
)
if in_blocklist:
return False, "in_blocklist"
if any(is_in_or_equal(path, allowed_path) for allowed_path in allowed_paths):
return True, "allowed"
if any(is_in_or_equal(path, created_path) for created_path in created_paths):
return True, "created"
return False, "not_created_or_allowed"
Gradio relies on is_in_or_equal
to determine if a file path is restricted. However, this logic fails to handle case variations in paths on case-insensitive file systems, leading to the bypass.
Proof of Concept (PoC)
Steps to Reproduce
-
Deploy a Gradio demo app on a case-insensitive operating system (e.g., Windows or macOS).
import gradio as gr def update(name): return f"Welcome to Gradio, {name}!" with gr.Blocks() as demo: gr.Markdown("Start typing below and then click **Run** to see the output.") with gr.Row(): inp = gr.Textbox(placeholder="What is your name?") out = gr.Textbox() btn = gr.Button("Run") btn.click(fn=update, inputs=inp, outputs=out) demo.launch(blocked_paths=['resources/admin'], allowed_paths=['resources/'])
-
Set up the file system:
-
Create a folder named
resources
in the same directory as the app, containing a file1.txt
. -
Inside the
resources
folder, create a subfolder namedadmin
containing a sensitive filecredential.txt
(this file should be inaccessible due toblocked_paths
).
-
-
Perform the attack:
-
Access the sensitive file using a case-altered path:
http://127.0.0.1:PORT/gradio_api/file=resources/adMin/credential.txt
-
Expected Result
Access to resources/admin/credential.txt
should be blocked.
Actual Result
By altering the case in the path (e.g., adMin
), the blocked ACL is bypassed, and unauthorized access to the sensitive file is granted.
This demonstration highlights that flipping the case of restricted paths allows attackers to bypass Gradio's ACL and access sensitive data.
Remediation Recommendations
-
Normalize Path Case:
-
Before evaluating paths against the ACL, normalize the case of both the requested path and the blocked paths (e.g., convert all paths to lowercase).
-
Example:
normalized_path = str(path).lower() normalized_blocked_paths = [str(p).lower() for p in blocked_paths]
-
-
Update Documentation:
- Warn developers about potential risks when deploying Gradio on case-insensitive file systems.
-
Release Security Patches:
- Notify users of the vulnerability and release an updated version of Gradio with the fixed logic.
Permalink: https://github.com/advisories/GHSA-j2jg-fq62-7c3h
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qMmpnLWZxNjItN2MzaM4ABDT6
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: 3 days ago
Updated: 3 days ago
EPSS Percentage: 0.00043
EPSS Percentile: 0.11266
Identifiers: GHSA-j2jg-fq62-7c3h, CVE-2025-23042
References:
- https://github.com/gradio-app/gradio/security/advisories/GHSA-j2jg-fq62-7c3h
- https://github.com/gradio-app/gradio/commit/6b63fdec441b5c9bf910f910a2505d8defbb6bf8
- https://github.com/gradio-app/gradio/releases/tag/gradio%405.11.0
- https://nvd.nist.gov/vuln/detail/CVE-2025-23042
- https://github.com/advisories/GHSA-j2jg-fq62-7c3h
Blast Radius: 0.0
Affected Packages
pypi:gradio
Dependent packages: 370Dependent repositories: 11,837
Downloads: 5,904,460 last month
Affected Version Ranges: < 5.11.0
Fixed in: 5.11.0
All affected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.4.0, 0.4.1, 0.4.2, 0.4.4, 0.5.0, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.7.5, 0.7.6, 0.7.7, 0.7.8, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.9.8, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.8, 1.1.9, 1.2.2, 1.2.3, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.2, 1.4.3, 1.4.4, 1.5.0, 1.5.1, 1.5.3, 1.5.4, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 2.0.0, 2.0.1, 2.0.2, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10, 2.1.0, 2.1.1, 2.1.2, 2.1.4, 2.1.6, 2.1.7, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.10, 2.2.11, 2.2.12, 2.2.13, 2.2.14, 2.2.15, 2.3.0, 2.3.3, 2.3.4, 2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.0, 3.47.1, 3.48.0, 3.49.0, 3.50.0, 3.50.1, 3.50.2, 4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.1.1, 4.1.2, 4.2.0, 4.3.0, 4.4.0, 4.4.1, 4.5.0, 4.7.0, 4.7.1, 4.8.0, 4.9.0, 4.9.1, 4.10.0, 4.11.0, 4.12.0, 4.13.0, 4.14.0, 4.15.0, 4.16.0, 4.17.0, 4.18.0, 4.19.0, 4.19.1, 4.19.2, 4.20.0, 4.20.1, 4.21.0, 4.22.0, 4.23.0, 4.24.0, 4.25.0, 4.26.0, 4.27.0, 4.28.0, 4.28.1, 4.28.2, 4.28.3, 4.29.0, 4.31.0, 4.31.1, 4.31.2, 4.31.3, 4.31.4, 4.31.5, 4.32.0, 4.32.1, 4.32.2, 4.33.0, 4.35.0, 4.36.0, 4.36.1, 4.37.1, 4.37.2, 4.38.0, 4.38.1, 4.39.0, 4.40.0, 4.41.0, 4.42.0, 4.43.0, 4.44.0, 4.44.1, 5.0.0, 5.0.1, 5.0.2, 5.1.0, 5.3.0, 5.4.0, 5.5.0, 5.6.0, 5.7.0, 5.7.1, 5.8.0, 5.9.0, 5.9.1, 5.10.0
All unaffected versions: 5.11.0, 5.12.0