CVE-2024-4941: Gradio: LFI via JSON path key exposes server files

HIGH PoC AVAILABLE CISA: TRACK*
Published June 6, 2024
CISO Take

Any internet-exposed Gradio instance ≤4.25 allows unauthenticated attackers to read arbitrary server files — including model weights, API keys, and .env configs — with a single crafted request. Patch to v4.26+ immediately and rotate all secrets on affected hosts. If Gradio fronted sensitive AI assets and was publicly reachable, treat as a confirmed compromise.

Risk Assessment

CVSS 7.5 understates real-world impact. Gradio is pervasively deployed for ML demos, internal model UIs, and production inference frontends — frequently co-located with .env files holding OpenAI/HuggingFace/Anthropic API keys and model checkpoints. Zero authentication required, exploit is trivial, and a working PoC is publicly documented on HackerOne. The combination of broad Gradio adoption and high-value adjacent assets elevates this to critical operational risk for AI/ML teams.

Affected Systems

Package Ecosystem Vulnerable Range Patched
gradio pip No patch
42.5K OpenSSF 5.6 674 dependents Pushed 8d ago 27% patched ~110d to patch Full package profile →

Do you use gradio? You're affected.

Severity & Risk

CVSS 3.1
7.5 / 10
EPSS
0.7%
chance of exploitation in 30 days
Higher than 72% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
Exploitation Confidence
medium
CISA SSVC: Public PoC
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, CISA SSVC, EPSS, trickest/cve, and Nuclei templates.

Attack Surface

AV AC PR UI S C I A
AV Network
AC Low
PR None
UI None
S Unchanged
C High
I None
A None

Recommended Action

5 steps
  1. Patch: Upgrade to Gradio ≥4.26 immediately (fix commit: ee1e294).

  2. Workaround: If patching is blocked, disable the JSON component or restrict the Gradio instance to internal networks via firewall.

  3. Rotate credentials: Audit and rotate all API keys, tokens, and secrets on affected hosts — assume .env and config files were read if exposure window existed.

  4. Detect exploitation: Search web server logs for requests matching /file=.*\.env, /file=.*/etc/, /file=.*id_rsa — unexpected paths outside the Gradio upload directory are indicators of exploitation.

  5. Asset inventory: Enumerate all Gradio instances in your environment; prioritize internet-facing and those with filesystem access to sensitive AI assets.

CISA SSVC Assessment

Decision Track*
Exploitation poc
Automatable Yes
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.8.2 - AI system data security
NIST AI RMF
MANAGE-2.2 - Mechanisms for identifying and implementing risk treatments for AI risks
OWASP LLM Top 10
LLM06:2025 - Excessive Agency / Sensitive Information Disclosure

Frequently Asked Questions

What is CVE-2024-4941?

Any internet-exposed Gradio instance ≤4.25 allows unauthenticated attackers to read arbitrary server files — including model weights, API keys, and .env configs — with a single crafted request. Patch to v4.26+ immediately and rotate all secrets on affected hosts. If Gradio fronted sensitive AI assets and was publicly reachable, treat as a confirmed compromise.

Is CVE-2024-4941 actively exploited?

Proof-of-concept exploit code is publicly available for CVE-2024-4941, increasing the risk of exploitation.

How to fix CVE-2024-4941?

1. Patch: Upgrade to Gradio ≥4.26 immediately (fix commit: ee1e294). 2. Workaround: If patching is blocked, disable the JSON component or restrict the Gradio instance to internal networks via firewall. 3. Rotate credentials: Audit and rotate all API keys, tokens, and secrets on affected hosts — assume .env and config files were read if exposure window existed. 4. Detect exploitation: Search web server logs for requests matching /file=.*\.env, /file=.*/etc/, /file=.*id_rsa — unexpected paths outside the Gradio upload directory are indicators of exploitation. 5. Asset inventory: Enumerate all Gradio instances in your environment; prioritize internet-facing and those with filesystem access to sensitive AI assets.

What systems are affected by CVE-2024-4941?

This vulnerability affects the following AI/ML architecture patterns: model serving, ML demos and prototypes, inference endpoints.

What is the CVSS score for CVE-2024-4941?

CVE-2024-4941 has a CVSS v3.1 base score of 7.5 (HIGH). The EPSS exploitation probability is 0.69%.

Technical Details

NVD Description

A local file inclusion vulnerability exists in the JSON component of gradio-app/gradio version 4.25. The vulnerability arises from improper input validation in the `postprocess()` function within `gradio/components/json_component.py`, where a user-controlled string is parsed as JSON. If the parsed JSON object contains a `path` key, the specified file is moved to a temporary directory, making it possible to retrieve it later via the `/file=..` endpoint. This issue is due to the `processing_utils.move_files_to_cache()` function traversing any object passed to it, looking for a dictionary with a `path` key, and then copying the specified file to a temporary directory. The vulnerability can be exploited by an attacker to read files on the remote system, posing a significant security risk.

Exploitation Scenario

An attacker identifies an organization's public Gradio ML demo via Shodan or direct enumeration. They POST a crafted JSON payload to the JSON component endpoint containing {"path": "/app/.env"}, triggering move_files_to_cache() to copy the .env file to /tmp/gradio/[uuid]/.env. A subsequent GET to /file=/tmp/gradio/[uuid]/.env returns the file contents — exposing OPENAI_API_KEY, HUGGINGFACE_TOKEN, or database credentials. The attacker uses the extracted API keys to query production LLM APIs at the victim's cost, pivot to HuggingFace to exfiltrate private model weights, or use database credentials to access training data stores. No authentication, no special tooling — a single crafted HTTP request pairs with a follow-up fetch.

Weaknesses (CWE)

CVSS Vector

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

Timeline

Published
June 6, 2024
Last Modified
October 15, 2025
First Seen
June 6, 2024

Related Vulnerabilities