CVE-2021-43831 is a high-severity (CVSS 7.7) Path Traversal vulnerability in gradio. 1 public exploit reference exists, so weaponization risk is real. A fix is available for gradio — see the affected versions and patch details below.
Files on the host computer can be accessed from the Gradio interface
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-43831 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 385,738 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
gradioReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
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

Patches
The problem has been patched in gradio>=2.5.0.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | gradio | all versions | 2.5.0pip install --upgrade 'gradio==2.5.0' |
Affected Products
gradiogradio_projectResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for gradio, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update gradio to 2.5.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-43831 is resolved across your whole dependency graph.
Workarounds
Resolve every user-supplied path to its canonical form and reject anything that escapes the intended directory, and run the component under an account that has no read or write access outside the directory it legitimately serves.
How to detect CVE-2021-43831
A community-maintained Nuclei template exists for this CVE. You can scan for it directly:
nuclei -id cve-2021-43831 -u https://target- Template
- Gradio < 2.5.0 - Arbitrary File Read
- Severity
- high
- Impact
- An attacker would be able to view the contents of a file on the computer.
- Remediation
- Update to version 2.5.0.
Template by ProjectDiscovery nuclei-templates (isacaya), MIT licensed. View the full template. Scan only systems you are authorised to test.
Frequently Asked Questions
Is CVE-2021-43831 in your dependencies?
Find it across PyPI, including transitive dependencies.