CVE-2024-47084
📋 TL;DR
This CVE allows malicious websites to bypass CORS origin validation in Gradio servers when cookies are present, enabling unauthorized requests to local Gradio instances. Attackers could potentially upload files, steal authentication tokens, and access user data. This affects users who have deployed Gradio locally with basic authentication enabled.
💻 Affected Systems
- gradio
📦 What is this software?
Gradio by Gradio Project
⚠️ Risk & Real-World Impact
Worst Case
Complete compromise of local Gradio server allowing file uploads, authentication token theft, and unauthorized data access leading to full system compromise.
Likely Case
Unauthorized file uploads and data exfiltration from local Gradio instances when users visit malicious websites while authenticated.
If Mitigated
Minimal impact with proper CORS validation and network segmentation in place.
🎯 Exploit Status
Exploitation requires user to visit malicious website while authenticated to local Gradio instance. Attack vector is straightforward once conditions are met.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: gradio>4.44
Vendor Advisory: https://github.com/gradio-app/gradio/security/advisories/GHSA-3c67-5hwx-f6wx
Restart Required: Yes
Instructions:
1. Check current Gradio version: pip show gradio
2. Upgrade to patched version: pip install --upgrade gradio>4.44
3. Restart all Gradio applications
🔧 Temporary Workarounds
Manual CORS Middleware Modification
allModify CustomCORSMiddleware class to enforce strict CORS validation even when cookies are present
Edit local Gradio server code to bypass condition that skips CORS validation for cookie-containing requests
🧯 If You Can't Patch
- Disable basic authentication in Gradio configurations
- Implement network segmentation to isolate Gradio instances from user browsing activities
🔍 How to Verify
Check if Vulnerable:
Check Gradio version: pip show gradio | grep Version. If version <= 4.44, system is vulnerable.
Check Version:
pip show gradio | grep Version
Verify Fix Applied:
Verify upgraded version: pip show gradio | grep Version. Confirm version > 4.44.
📡 Detection & Monitoring
Log Indicators:
- Unexpected cross-origin requests to Gradio endpoints
- File uploads from unexpected origins
- Authentication attempts from non-local sources
Network Indicators:
- Cross-origin requests to local Gradio ports (typically 7860)
- POST requests to /upload endpoints from external domains
SIEM Query:
source_port:7860 AND http.method:POST AND NOT src_ip:127.0.0.1