CVE-2021-43831: Gradio Files On The Host Computer Vulnerability
CRITICALCVE-2021-43831 is a CRITICAL (CVSS 8.3) files on the host computer vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Gradio libraries in the PyPI ecosystem. The issue involves files on the host computer can be accessed from the gradio interface. Remediation is available by upgrading affected packages to version 2.5.0.
CVE-2021-43831 at a Glance
Security Impact
CVSS: 8.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L).
How to Fix CVE-2021-43831
To remediate this vulnerability, upgrade all affected Gradio dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install gradio>=2.5.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show gradio
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-43831, inspect your installed packages using pip:
pip show gradio
Analyze the terminal output to locate any version of Gradio in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.5.0), your application is affected.
Note: The pip show gradio command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Gradio, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-43831 Affected Gradio Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
gradio
|
PyPI |
< 2.5.0
|
2.5.0
|
References
Frequently Asked Questions
What is CVE-2021-43831?
Which Gradio versions are affected?
What version fixes CVE-2021-43831?
Is gradio affected?
What is the CVSS score of CVE-2021-43831?
What CWE is associated with CVE-2021-43831?
How can I check PyPI dependencies for CVE-2021-43831?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rhq2-3vr9-6mcr",
"modified" : "2024-11-18T16:26:18Z",
"published" : "2022-01-21T23:43:33Z",
"aliases" : [ "CVE-2021-43831" ],
"summary" : "Files on the host computer can be accessed from the Gradio interface",
"details" : "### Impact\nThis 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)\n\n### Response\n1. 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 \n2. We enabled a notification that is printed to anyone using an older version of gradio telling them to upgrade (see screenshot below)\n3. We expanded our test suite to test for this vulnerability ensuring that our patch does not get reverted in future releases of `gradio`\n\n\n\n### Patches\nThe problem has been patched in `gradio>=2.5.0`.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "gradio"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.5.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/gradio-app/gradio/security/advisories/GHSA-rhq2-3vr9-6mcr"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43831"
}, {
"type" : "WEB",
"url" : "https://github.com/gradio-app/gradio/commit/41bd3645bdb616e1248b2167ca83636a2653f781"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/gradio-app/gradio"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/gradio/PYSEC-2021-873.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-01-18T21:15:21Z",
"nvd_published_at" : "2021-12-15T20:15:00Z"
}
}