CVE-2024-1561

7.5 HIGH

📋 TL;DR

This vulnerability in gradio allows attackers to read any file on the filesystem by exploiting the /component_server endpoint. It affects gradio applications exposed to the internet via share=True and those hosted on huggingface.co, potentially exposing sensitive information like API keys and credentials.

💻 Affected Systems

Products:
  • gradio
Versions: Versions before 4.13.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Applications using share=True or hosted on huggingface.co are particularly vulnerable to remote exploitation.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of sensitive files including environment variables, configuration files, and credentials leading to lateral movement or data exfiltration.

🟠

Likely Case

Unauthorized reading of sensitive files containing API keys, credentials, or configuration data from exposed gradio applications.

🟢

If Mitigated

Limited impact with proper network segmentation and access controls preventing external exploitation.

🌐 Internet-Facing: HIGH - Applications exposed via share=True or hosted on huggingface.co are directly vulnerable to remote exploitation.
🏢 Internal Only: MEDIUM - Internal applications still vulnerable but require internal network access for exploitation.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending crafted requests to the /component_server endpoint to invoke the vulnerable move_resource_to_block_cache() method.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.13.0

Vendor Advisory: https://www.gradio.app/changelog#4-13-0

Restart Required: Yes

Instructions:

1. Update gradio to version 4.13.0 or later using pip install --upgrade gradio>=4.13.0
2. Restart all gradio applications
3. Verify the update with pip show gradio

🔧 Temporary Workarounds

Disable share mode

all

Avoid using launch(share=True) which exposes applications to the internet

Network segmentation

all

Restrict network access to gradio applications using firewalls or network policies

🧯 If You Can't Patch

  • Restrict network access to gradio applications using firewall rules to allow only trusted sources
  • Monitor /component_server endpoint access in application logs for suspicious activity

🔍 How to Verify

Check if Vulnerable:

Check gradio version with pip show gradio or python -c "import gradio; print(gradio.__version__)" and verify if below 4.13.0

Check Version:

python -c "import gradio; print(gradio.__version__)"

Verify Fix Applied:

Confirm gradio version is 4.13.0 or higher using pip show gradio

📡 Detection & Monitoring

Log Indicators:

  • Unusual requests to /component_server endpoint
  • Access to move_resource_to_block_cache method
  • File read operations from unexpected paths

Network Indicators:

  • HTTP requests to /component_server with crafted parameters
  • Unusual file retrieval patterns from gradio applications

SIEM Query:

source="gradio" AND (uri_path="/component_server" OR method="move_resource_to_block_cache")

🔗 References

📤 Share & Export