CVE-2024-47870

8.1 HIGH

📋 TL;DR

A race condition in Gradio's update_root_in_config function allows attackers to redirect frontend-backend communication to malicious servers. This could intercept sensitive data like credentials or uploaded files. All Gradio users, especially those with internet-exposed servers, are affected.

💻 Affected Systems

Products:
  • gradio
Versions: All versions before gradio 5.0
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: All Gradio deployments using affected versions are vulnerable regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete interception of all user data including authentication credentials, session tokens, and uploaded files, leading to account compromise and data theft.

🟠

Likely Case

Selective interception of user sessions and file uploads when attackers successfully exploit the race condition window.

🟢

If Mitigated

Limited impact with proper network segmentation and monitoring, though the vulnerability still exists.

🌐 Internet-Facing: HIGH - Internet-exposed Gradio servers are directly accessible to attackers who can exploit this race condition.
🏢 Internal Only: MEDIUM - Internal attackers or compromised internal systems could exploit this, but requires network access to the Gradio server.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires precise timing to win the race condition, but no authentication is needed to attempt exploitation.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: gradio>=5.0

Vendor Advisory: https://github.com/gradio-app/gradio/security/advisories/GHSA-xh2x-3mrm-fwqm

Restart Required: Yes

Instructions:

1. Stop the Gradio server. 2. Run: pip install --upgrade gradio>=5.0. 3. Restart the Gradio server.

🧯 If You Can't Patch

  • Isolate Gradio servers behind firewalls with strict network access controls.
  • Monitor network traffic for unexpected redirects or connections to unknown servers.

🔍 How to Verify

Check if Vulnerable:

Check Gradio version with: python -c "import gradio; print(gradio.__version__)" and verify if version is below 5.0.

Check Version:

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

Verify Fix Applied:

After upgrade, verify version is 5.0 or higher using the same command.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected configuration changes to root URL
  • Multiple rapid requests to update_root_in_config endpoint

Network Indicators:

  • Frontend connections to unexpected IP addresses or domains
  • Traffic patterns showing redirection to non-Gradio servers

SIEM Query:

source="gradio_logs" AND (event="config_change" OR event="root_update") AND rate > 10 per minute

🔗 References

📤 Share & Export