CVE-2024-1561
📋 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
- gradio
📦 What is this software?
Gradio by Gradio Project
⚠️ 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.
🎯 Exploit Status
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
allAvoid using launch(share=True) which exposes applications to the internet
Network segmentation
allRestrict 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
- https://github.com/gradio-app/gradio/commit/24a583688046867ca8b8b02959c441818bdb34a2
- https://huntr.com/bounties/4acf584e-2fe8-490e-878d-2d9bf2698338
- https://www.gradio.app/changelog#4-13-0
- https://github.com/gradio-app/gradio/commit/24a583688046867ca8b8b02959c441818bdb34a2
- https://huntr.com/bounties/4acf584e-2fe8-490e-878d-2d9bf2698338
- https://www.gradio.app/changelog#4-13-0