Platform
python
Component
gradio
Fixed in
4.31.4
4.31.3
CVE-2024-4941 describes a local file inclusion vulnerability discovered in the Gradio Python library. This flaw allows an attacker to potentially retrieve arbitrary files from the server by manipulating JSON data. The vulnerability impacts versions of Gradio up to and including 4.9.1, and a fix is available in version 4.31.3.
The vulnerability lies within the postprocess() function of the JSON component, specifically in how it handles user-supplied JSON data. An attacker can craft a malicious JSON object containing a path key. When this object is parsed, the processingutils.movefilestocache() function is triggered, traversing the object and potentially moving files to a temporary directory. Subsequently, the attacker can access these files via the /file=.. endpoint, effectively bypassing access controls and retrieving sensitive data. The potential impact includes exposure of configuration files, source code, or any other files accessible by the Gradio application.
CVE-2024-4941 was publicly disclosed on 2024-06-06. While no active exploitation campaigns have been publicly reported, the availability of a proof-of-concept could lead to opportunistic attacks. The vulnerability is not currently listed on the CISA KEV catalog. The ease of exploitation, combined with the potential for data exposure, warrants prompt remediation.
Exploit Status
EPSS
0.56% (68% percentile)
CISA SSVC
CVSS Vector
The primary mitigation for CVE-2024-4941 is to upgrade to Gradio version 4.31.3 or later, which includes the necessary fix. If upgrading is not immediately feasible, consider implementing a Web Application Firewall (WAF) rule to block requests containing the /file=.. endpoint. Additionally, restrict file access permissions on the server to minimize the potential impact of a successful exploit. Thoroughly review and sanitize all user-supplied input to prevent malicious JSON payloads from being processed. After upgrading, confirm the fix by attempting to access a file via the /file=.. endpoint; it should return an error.
Update the gradio library to version 4.31.4 or higher. This corrects the local file inclusion vulnerability in the JSON component. The update can be performed using the pip package manager: `pip install --upgrade gradio`.
Vulnerability analysis and critical alerts directly to your inbox.
CVE-2024-4941 is a HIGH severity vulnerability in Gradio versions ≤4.9.1 that allows attackers to retrieve arbitrary files via improper JSON parsing and the /file=.. endpoint.
You are affected if you are using Gradio versions 4.9.1 or earlier. Upgrade to 4.31.3 or later to resolve the vulnerability.
Upgrade to Gradio version 4.31.3 or later. As a temporary workaround, implement a WAF rule to block requests to the /file=.. endpoint.
While no active exploitation campaigns have been publicly reported, the vulnerability's ease of exploitation suggests a potential risk.
Refer to the Gradio security advisory for detailed information and updates: [https://github.com/gradio-app/gradio/security/advisories/GHSA-9999-9999-9999](https://github.com/gradio-app/gradio/security/advisories/GHSA-9999-9999-9999)
Upload your dependency file and we'll tell you instantly if this and other CVEs hit you.
Upload your requirements.txt file and we'll tell you instantly if you're affected.