CVE-2024-4941
📋 TL;DR
This CVE describes a local file inclusion vulnerability in gradio-app/gradio version 4.25. Attackers can exploit improper JSON parsing in the postprocess() function to read arbitrary files from the remote system by manipulating the 'path' key in JSON input. This affects any system running the vulnerable gradio version with JSON components enabled.
💻 Affected Systems
- gradio-app/gradio
📦 What is this software?
Gradio by Gradio Project
⚠️ Risk & Real-World Impact
Worst Case
Complete system compromise through reading sensitive files like /etc/passwd, SSH keys, configuration files, or database credentials, potentially leading to lateral movement or data exfiltration.
Likely Case
Unauthorized reading of application files, configuration data, or user-uploaded files stored in accessible directories.
If Mitigated
Limited impact with proper file permissions and network segmentation, potentially only reading non-sensitive application files.
🎯 Exploit Status
Exploitation requires sending crafted JSON with a 'path' key to vulnerable endpoints; proof-of-concept exists in public references.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Versions after commit ee1e2942e0a1ae84a08a05464e41c8108a03fa9c
Vendor Advisory: https://github.com/gradio-app/gradio/commit/ee1e2942e0a1ae84a08a05464e41c8108a03fa9c
Restart Required: Yes
Instructions:
1. Update gradio to latest version using 'pip install --upgrade gradio'. 2. Verify version is >4.25. 3. Restart all gradio applications.
🔧 Temporary Workarounds
Disable JSON component
allRemove or disable JSON input components from gradio applications if not required.
Input validation middleware
allImplement custom middleware to validate and sanitize JSON input before processing.
🧯 If You Can't Patch
- Implement strict file system permissions to limit readable directories
- Deploy network segmentation and WAF rules to block suspicious JSON payloads
🔍 How to Verify
Check if Vulnerable:
Check if running gradio version 4.25: 'pip show gradio' or examine package metadata.
Check Version:
pip show gradio | grep Version
Verify Fix Applied:
Verify gradio version is updated beyond 4.25 and test JSON input with 'path' key to ensure no file access occurs.
📡 Detection & Monitoring
Log Indicators:
- Unusual file access patterns from gradio process
- JSON payloads containing 'path' keys with file paths
Network Indicators:
- HTTP requests to /file= endpoints with unusual file paths
- JSON POST requests with path traversal patterns
SIEM Query:
source="gradio" AND (json.path=* OR file_access=*)