CVE-2021-43831: Files on the host computer can be accessed from the Gradio interface
Gradio versions before 2.4.8 served static files in a way that exposed other files on the computer while a public share link was active. An attacker who knew an exact relative file path could read the file. The advisory marks 2.5.0 as the fix. Upgrade to gradio 2.5.0 or later.
Published Jan 21, 2022 · Updated Nov 18, 2024 · Analysis Nov 2, 2026
What an attacker can do
Anyone who created a public Gradio link and shared it exposed more than the interface. Because of how static files were served, a visitor could request a file on the host by its relative path and get the contents back. The attacker needed to know the exact path, so guessing common locations such as config files, notebooks or key files was the practical route.
The maintainers say they have no evidence of exploitation. They patched it with the reporter haby0 within 24 hours of the report, added a notice printed to users on older versions, and expanded the test suite so the fix is not reverted.
The exposure lasted only while a public link was active, and it covered files the Gradio process could read. For a developer on a laptop, that can include source code, SSH keys and cloud credentials in the home directory.
Who is affected
pip package gradio older than 2.5.0. The advisory text says the problem affects public sharing with gradio<2.4.8. Check:
pip show gradioApps never shared publicly were far less exposed than those with an active share link.
gradio
- Ecosystem
- PyPI
- Affected
- < 2.5.0
- Fixed in
- 2.5.0
- Check
pip show gradio
How to fix it
Upgrade to gradio 2.5.0 or later:
pip install --upgrade "gradio>=2.5.0"Older versions print a notice telling users to upgrade. The fix was released within 24 hours of the report. If you shared an interface on an old version, consider the files readable by that process as exposed and rotate any keys stored there.
How to tell if you were hit
Check Gradio or proxy logs from the time a share link was active for requests to static paths with .. segments or paths to sensitive files such as ~/.ssh/id_rsa or .env. The maintainers say they have no evidence of exploitation, so a clean log is the likely result.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
This is a vulnerability that affects anyone who creates and publicly shares Gradio interfaces using gradio<2.4.8. Because of the way that static files were being served, someone who generated a public Gradio link and shared it with others would potentially be exposing the files on the computer that generated the link, while the link was active. An attacker would be able to view the contents of a file on the computer if they knew the exact relative filepath. We do not have any evidence that this was ever exploited, but we treated the issue seriously and immediately took steps to mitigate it (see below)
Response
- We worked with @haby0 to immediately patch the issue and released a new version,
gradio 2.5.0, within 24 hours of the issue being brought to our attention - We enabled a notification that is printed to anyone using an older version of gradio telling them to upgrade (see screenshot below)
- We expanded our test suite to test for this vulnerability ensuring that our patch does not get reverted in future releases of
gradio
image
Patches
The problem has been patched in gradio>=2.5.0.
Credited to haby0.
Questions
- Was CVE-2021-43831 exploited?
The maintainers say they have no evidence that it was ever exploited. It is not in CISA's KEV data.
- Does the attacker need to know file names?
Yes. The advisory says the attacker needed the exact relative file path.
- Why does the advisory say 2.4.8 and the fix is 2.5.0?
The text says versions below 2.4.8 are affected, while the patch was released as 2.5.0. Use 2.5.0 or later, which the data lists as patched.
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
