CVE-2023-34239 Overview
CVE-2023-34239 is a critical vulnerability affecting Gradio, an open-source Python library widely used for building machine learning and data science web interfaces. The vulnerability stems from improper input validation that allows attackers to exploit two distinct security flaws: a path traversal vulnerability due to lack of path filtering, and a Server-Side Request Forgery (SSRF) issue caused by improper URL proxy restrictions. These flaws enable unauthorized file access and potential abuse of the proxy functionality to reach internal resources.
Critical Impact
Unauthenticated remote attackers can access sensitive files on the server and abuse proxy functionality to reach internal network resources, potentially leading to data exfiltration and lateral movement within protected networks.
Affected Products
- Gradio versions prior to 3.34.0
- gradio_project gradio (Python package)
- Machine learning applications built with vulnerable Gradio versions
Discovery Timeline
- 2023-06-08 - CVE-2023-34239 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2023-34239
Vulnerability Analysis
This vulnerability combines two critical security weaknesses in the Gradio library. The first issue involves insufficient path filtering, which allows attackers to traverse directory structures and access files outside the intended web root. The second issue relates to improper URL validation in the proxy functionality, enabling Server-Side Request Forgery attacks. Together, these flaws create a significant attack surface that can be exploited remotely without authentication, potentially compromising confidentiality and integrity of affected systems.
The vulnerability is classified under CWE-20 (Improper Input Validation), highlighting that the root cause is the application's failure to properly sanitize and validate user-supplied input before processing file paths and proxy URLs.
Root Cause
The root cause of CVE-2023-34239 lies in Gradio's failure to implement proper input validation and sanitization mechanisms. Specifically, the library lacks adequate path filtering for file access operations, allowing directory traversal sequences (such as ../) to escape the intended directory structure. Additionally, the URL proxy functionality does not maintain an allowlist or properly restrict which URLs can be proxied, enabling attackers to make requests to arbitrary internal or external endpoints through the application.
Attack Vector
The attack vector for this vulnerability is network-based and requires no authentication or user interaction. An attacker can exploit the path traversal vulnerability by crafting malicious requests containing directory traversal sequences to access sensitive files such as configuration files, credentials, or application source code.
For the SSRF component, attackers can manipulate proxy requests to access internal services, cloud metadata endpoints, or other resources that should not be externally accessible. This could lead to:
- Unauthorized access to sensitive configuration files
- Exposure of internal network services
- Cloud metadata harvesting in cloud-hosted environments
- Potential for further lateral movement within the network
Technical details regarding the specific exploitation mechanisms can be found in the GitHub Security Advisory GHSA-3qqg-pgqq-3695.
Detection Methods for CVE-2023-34239
Indicators of Compromise
- HTTP requests containing path traversal sequences such as ../, ..%2f, or URL-encoded variants targeting Gradio endpoints
- Unusual proxy requests to internal IP addresses (e.g., 127.0.0.1, 169.254.169.254, 10.x.x.x, 192.168.x.x)
- Access logs showing requests for sensitive files like /etc/passwd, configuration files, or application secrets
- Unexpected outbound connections from the Gradio application to internal services
Detection Strategies
- Implement web application firewall (WAF) rules to detect and block path traversal patterns in incoming requests
- Monitor application logs for requests containing ../ sequences or attempts to access files outside the web root
- Deploy network monitoring to identify SSRF attempts targeting internal services or cloud metadata endpoints
- Use SentinelOne's behavioral AI to detect anomalous file access patterns and network connections from Gradio-based applications
Monitoring Recommendations
- Enable verbose logging on Gradio applications to capture all incoming requests and proxy activities
- Configure alerting for access attempts to sensitive system files or directories
- Monitor network traffic for connections to internal IP ranges originating from publicly-accessible Gradio instances
- Regularly audit Gradio application dependencies and version information
How to Mitigate CVE-2023-34239
Immediate Actions Required
- Upgrade Gradio to version 3.34.0 or later immediately
- Review application logs for any evidence of exploitation attempts
- Audit file access logs to identify potential unauthorized file reads
- Implement network segmentation to limit the impact of potential SSRF exploitation
Patch Information
The Gradio development team has addressed these vulnerabilities in version 3.34.0. The fixes were implemented through two separate pull requests:
- GitHub Pull Request #4370 - Addresses the path filtering issue
- GitHub Pull Request #4406 - Implements proper URL proxy restrictions
Users should upgrade using pip:
pip install --upgrade gradio>=3.34.0
Workarounds
- There are no known workarounds for this vulnerability according to the vendor advisory
- Implement network-level access controls to restrict who can access Gradio applications
- Deploy a web application firewall (WAF) with rules to block path traversal and SSRF patterns as a temporary measure
- Consider running Gradio applications in isolated network environments until patching is complete
# Upgrade Gradio to patched version
pip install --upgrade gradio>=3.34.0
# Verify installed version
pip show gradio | grep Version
# For requirements.txt, specify minimum version
echo "gradio>=3.34.0" >> requirements.txt
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

