CVE-2024-47872: Gradio has an XSS on every Gradio server via upload of HTML files, JS files, or SVG files
Gradio before 5.0.0 lets authenticated users upload HTML, JavaScript or SVG files that run as scripts in other users' browsers when those users open them. Any Gradio server that accepts file uploads is affected. Upgrade to gradio 5.0.0 or later.
Published Oct 10, 2024 · Updated Jan 21, 2025 · Analysis Nov 10, 2026
What an attacker can do
A Gradio server that takes file uploads stores what users send and serves it back from the same origin. If the file is HTML, JavaScript or SVG, the browser executes the embedded script when another user downloads or views it. That is stored cross-site scripting (CWE-79) on the server's own origin.
The attacker needs a login that allows uploads and needs a second user to open the file, which is why the CVSS 3.1 score is 5.4 with a changed scope. The script can act as the victim and read data in their session. The advisory says the issue affects every Gradio server with uploads, most of all those using components that process or show uploaded files. Public demos and shared internal tools, where many users see one another's files, are the realistic targets.
Who is affected
gradio below 5.0.0, on any app that permits file uploads. Check:
pip show gradioCheck every environment that runs a Gradio app, including Hugging Face Space containers you build yourself.
gradio
- Ecosystem
- PyPI
- Affected
- < 5.0.0
- Fixed in
- 5.0.0
- Check
pip show gradio
How to fix it
Upgrade to gradio 5.0.0 or later:
pip install --upgrade "gradio>=5.0.0"The advisory also lists workarounds if you cannot upgrade: restrict uploads to non-executable file types such as images or text, and add server-side validation that rejects or sanitizes HTML, JavaScript and SVG files before they are stored or shown.
How to tell if you were hit
Look in the upload storage and the Gradio temp directory for files with .html, .htm, .js or .svg extensions that users should not be sending. Check access logs for requests that fetch such files, and for uploads by accounts you do not recognize.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
What kind of vulnerability is it? Who is impacted?
This vulnerability involves Cross-Site Scripting (XSS) on any Gradio server that allows file uploads. Authenticated users can upload files such as HTML, JavaScript, or SVG files containing malicious scripts. When other users download or view these files, the scripts will execute in their browser, allowing attackers to perform unauthorized actions or steal sensitive information from their sessions. This impacts any Gradio server that allows file uploads, particularly those using components that process or display user-uploaded files.
Patches
Yes, please upgrade to gradio>=5 to address this issue.
Workarounds
Is there a way for users to fix or remediate the vulnerability without upgrading?
As a workaround, users can restrict the types of files that can be uploaded to the Gradio server by limiting uploads to non-executable file types such as images or text. Additionally, developers can implement server-side validation to sanitize uploaded files, ensuring that HTML, JavaScript, and SVG files are properly handled or rejected before being stored or displayed to users.
Credited to ahpaleus, Vasco-jofra.
Questions
- Does the attacker need an account?
Yes, an authenticated user who can upload. A second user must open the file.
- Which version fixes CVE-2024-47872?
gradio 5.0.0 fixes it. The advisory says to upgrade to gradio 5 or later.
- Is there a workaround?
Yes. Limit uploads to non-executable types and validate files on the server.
References
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
