CVE-2024-47872 Cross-site Scripting on Gradio server via upload of HTML files, JS files, or SVG files

Medium 6.9 Published Updated

Authenticated users can upload malicious HTML, JS, or SVG files to Gradio servers, leading to XSS attacks against other users viewing the files.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-47872?

CVE-2024-47872 is a medium-severity cross-site scripting vulnerability in Gradio Project Gradio, published on 10 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Gradio is an open-source Python package designed for quick prototyping. 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. Users are advised to upgrade to `gradio>=5` to address this issue. 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.

Weakness: CWE-79

Which versions are affected by CVE-2024-47872?

3 open source packages ship an affected version, including gradio. It affects 1 product.

PackageAffectedFixed in
gradio PyPIAll versions5.0.0
gradio PyPIAll versions5.0.0
gradio PyPIAll versions5.0.0

Products include Gradio Project Gradio.

How do I fix CVE-2024-47872?

Upgrade gradio to 5.0.0 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2024-47872 being exploited?

There is no known exploitation of CVE-2024-47872 in the wild and no public exploit code.

All Gradio Project Gradio vulnerabilities

Sources

Also known as GHSA-gvv6-33j7-884g, PYSEC-2024-220.

Is CVE-2024-47872 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free