Vulnerability · Published Oct 10, 2024 · Assigned by GitHub_M
CVE-2024-47164The `is_in_or_equal` function may be bypassed in Gradio
Low 2.3
In plain English
A low-severity path traversal in gradio from gradio-app. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.7% (higher than 54% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
Gradio is an open-source Python package designed for quick prototyping. This vulnerability relates to the **bypass of directory traversal checks** within the `is_in_or_equal` function. This function, intended to check if a file resides within a given directory, can be bypassed with certain payloads that manipulate file paths using `..` (parent directory) sequences. Attackers could potentially access restricted files if they are able to exploit this flaw, although the difficulty is high. This primarily impacts users relying on Gradio’s blocklist or directory access validation, particularly when handling file uploads. Users are advised to upgrade to `gradio>=5.0` to address this issue. As a workaround, users can manually sanitize and normalize file paths in their Gradio deployment before passing them to the `is_in_or_equal` function. Ensuring that all file paths are properly resolved and absolute can help mitigate the bypass vulnerabilities caused by the improper handling of `..` sequences or malformed paths.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| PyPI | gradio | 5.0.0 | GHSA-77xq-6g77-h274 |
| PyPI | gradio | 5.0.0 | PYSEC-2024-213 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| gradio-app | gradio | < 5.0 |
Weakness: CWE-22 · Vector: CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
References
- https://github.com/gradio-app/gradio/security/advisories/GHSA-77xq-6g77-h274 x_refsource_CONFIRM