CVE-2024-47164: Gradio's `is_in_or_equal` function may be bypassed
Gradio before 5.0 has a directory-traversal check, is_in_or_equal, that special '..' path payloads can bypass. An attacker who gets one through may reach files outside the allowed directory, mostly where Gradio's blocklist or directory validation guards uploads. Exploitation is rated difficult. Upgrade to gradio 5.0.0.
Published Oct 10, 2024 · Updated Jan 21, 2025 · Analysis Nov 1, 2026
What an attacker can do
The is_in_or_equal function decides whether a file sits inside a given directory. Gradio uses it for its blocklist and directory access checks. The advisory says certain payloads that use '..' (parent directory) sequences, or malformed paths, make it give the wrong answer. A path that points outside the directory is then accepted as inside.
An attacker who gets such a path through can reach restricted files. The advisory notes the difficulty is high, and the CVSS vectors rate the effect as low confidentiality and low integrity, with no availability impact. It matters most to users who rely on Gradio's blocklist or directory validation when handling file uploads.
The fix commit titled "Some tweaks to is_in_or_equal" (pull request 9020) also routes path joining in routes.py and the file explorer component through one shared safe_join in utils.py. A failed containment check raises a new InvalidPathError, which the routes turn into a 403.
Who is affected
gradio on pip, all versions below 5.0.0. Apps that handle file paths or uploads and rely on Gradio's directory checks are the relevant ones. Check the version:
pip show gradiogradio
- Ecosystem
- PyPI
- Affected
- < 5.0.0
- Fixed in
- 5.0.0
- Check
pip show gradio
How to fix it
Upgrade to gradio 5.0 or later; the package data gives 5.0.0 as the patched version:
pip install --upgrade "gradio>=5.0"The advisory's workaround for those who cannot upgrade: sanitize and normalize file paths before they reach is_in_or_equal, and make sure all paths are resolved and absolute, which removes the '..' handling problems.
How to tell if you were hit
Look in request logs for file or upload paths that contain '..' sequences, encoded variants or unusual separators. Check Gradio server logs for access to files outside the app's allowed directories. After the upgrade, blocked attempts return a 403 response.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
What kind of vulnerability is it? Who is impacted?
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.
Patches
Yes, please upgrade to gradio>=5.0 to address this issue.
Workarounds
Is there a way for users to fix or remediate the vulnerability without upgrading?
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.
Credited to Vasco-jofra, ahpaleus.
Questions
- How hard is it to exploit CVE-2024-47164?
The advisory says the difficulty is high. The attacker needs a payload with '..' sequences or malformed paths that fools is_in_or_equal, though the CVSS vector still lists network access with no privileges.
- Which version fixes it?
gradio 5.0.0. The related fix commit also adds a shared safe_join and an InvalidPathError.
- Can I work around it without upgrading?
Yes, partly. Normalize and resolve all file paths to absolute form before passing them to is_in_or_equal.
References
Read for this analysis:
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Gradio vulnerabilities
All Gradio entriesCVE-2026-49119
Gradio FileExplorer preprocess path traversal allows files outside root_dir to reach callbacks
high7.5Jul 1, 2026CVE-2026-10783
Gradio: Audio cache key ignores metadata when saving numpy audio outputs
low2.5Jun 4, 2026CVE-2026-48545
Gradio contains a cookie injection vulnerability
high6.8May 27, 2026CVE-2026-27167
Gradio: Mocked OAuth Login Exposes Server Credentials and Uses Hardcoded Session Secret
lowMar 1, 2026CVE-2026-28414
Gradio is Vulnerable to Absolute Path Traversal on Windows with Python 3.13+
high7.5Mar 1, 2026CVE-2026-28415
Gradio has an Open Redirect in its OAuth Flow
medium4.3Mar 1, 2026
