CVE-2024-8021
📋 TL;DR
An open redirect vulnerability in gradio-app/gradio allows attackers to redirect users to malicious websites using URL encoding. This affects all users of vulnerable gradio versions who interact with the application. Attackers can exploit this by sending crafted requests that trigger 302 redirects to attacker-controlled sites.
💻 Affected Systems
- gradio-app/gradio
📦 What is this software?
Gradio by Gradio Project
⚠️ Risk & Real-World Impact
Worst Case
Users are redirected to phishing sites that steal credentials or deliver malware, leading to account compromise or system infection.
Likely Case
Users are redirected to phishing or scam websites, potentially resulting in credential theft or financial loss.
If Mitigated
Redirects are validated and restricted to trusted domains only, preventing malicious redirections.
🎯 Exploit Status
Exploitation requires sending crafted requests but no authentication or special privileges.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Check gradio repository for latest patched version
Vendor Advisory: https://huntr.com/bounties/adc23067-ec04-47ef-9265-afd452071888
Restart Required: Yes
Instructions:
1. Update gradio to the latest patched version
2. Restart the application/service
3. Verify the fix is applied
🔧 Temporary Workarounds
Input Validation Filter
allImplement server-side validation to reject or sanitize redirect URLs containing encoded characters
Implement custom middleware to validate redirect URLs before processing
Redirect Whitelist
allRestrict redirects to predefined trusted domains only
Configure application to only allow redirects to approved domain list
🧯 If You Can't Patch
- Implement WAF rules to block requests with suspicious redirect parameters
- Monitor logs for unusual redirect patterns and implement alerting
🔍 How to Verify
Check if Vulnerable:
Test by sending a request with URL-encoded redirect parameter to see if it redirects to external site
Check Version:
pip show gradio | grep Version
Verify Fix Applied:
Test the same exploit attempt after patching - it should not redirect to external sites
📡 Detection & Monitoring
Log Indicators:
- 302 redirect responses to external domains
- Requests with encoded URL parameters
Network Indicators:
- Unexpected redirects to unfamiliar domains
- HTTP 302 responses with external Location headers
SIEM Query:
http.status_code=302 AND NOT url.domain IN (trusted_domains)