NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Gradio

CVE-2024-47084: Gradios's CORS origin validation is not performed when the request has a cookie

highCVSS 4.0 8.7 · 3.1 8.8GHSA-3c67-5hwx-f6wx

Gradio before 4.44.0 skips CORS origin validation when a request carries a cookie. A malicious website can then send requests to a Gradio server running on the victim's machine, using the victim's logged-in session, to upload files, steal tokens and read data. It mainly affects local deployments with basic authentication. Upgrade to gradio 4.44.0.

Published Oct 10, 2024 · Updated Jan 21, 2025 · Analysis Nov 1, 2026

What an attacker can do

Gradio's CustomCORSMiddleware validates the origin of cross-origin requests, but it skips that check when the request has a cookie. A browser attaches the Gradio session cookie to requests to that server. So if a user is logged into a local Gradio app and opens an attacker's web page, script on that page can call the Gradio server and the origin check never runs.

The attacker's page acts with the victim's session. The advisory says this can let the attacker upload files, steal authentication tokens and access user data. The CVSS vectors show network access, no privileges and user interaction required, with high impact on confidentiality, integrity and availability.

The advisory says it hits users who deploy Gradio locally and use basic authentication. The attacker does not need network access to the machine. They only need the user to visit a page while logged in. A developer who keeps a Gradio app open on localhost for model tests, with data or tools behind it, is the typical target.

Who is affected

gradio on pip, all versions below 4.44.0. Highest risk: Gradio servers run locally with basic authentication, opened in a browser that also visits untrusted sites. Check your version:

pip show gradio

gradio

Ecosystem
PyPI
Affected
< 4.44.0
Fixed in
4.44.0
Check
pip show gradio

How to fix it

Upgrade to gradio 4.44 or later:

pip install --upgrade "gradio>=4.44"

The patched version in the package data is 4.44.0. If you cannot upgrade, the advisory's workaround is to edit the CustomCORSMiddleware class in your local Gradio server code and remove the condition that skips origin validation for requests with cookies, so they are checked like any other request.

How to tell if you were hit

Look in the Gradio server logs for requests that carry an Origin header from a domain you do not recognise, together with a session cookie. Check for files you did not upload and for sessions or tokens that were used from unexpected places. Review the browser history on the machine for untrusted sites visited while a Gradio app was logged in.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

What kind of vulnerability is it? Who is impacted?

This vulnerability is related to CORS origin validation, where the Gradio server fails to validate the request origin when a cookie is present. This allows an attacker’s website to make unauthorized requests to a local Gradio server. Potentially, attackers can upload files, steal authentication tokens, and access user data if the victim visits a malicious website while logged into Gradio. This impacts users who have deployed Gradio locally and use basic authentication.

Patches

Yes, please upgrade to gradio>=4.44 to address this issue.

Workarounds

Is there a way for users to fix or remediate the vulnerability without upgrading?

As a workaround, users can manually enforce stricter CORS origin validation by modifying the CustomCORSMiddleware class in their local Gradio server code. Specifically, they can bypass the condition that skips CORS validation for requests containing cookies to prevent potential exploitation.

Credited to ahpaleus, Vasco-jofra.

Questions

Does the attacker need access to my network for CVE-2024-47084?

No. The attacker's website runs in the victim's browser and sends requests to the local Gradio server. The victim must visit that site while logged in to Gradio.

Is it only a risk for local deployments?

The advisory says it affects users who deploy Gradio locally and use basic authentication. Any version below 4.44.0 has the flawed cookie check.

Is there a workaround besides upgrading?

Yes. Edit CustomCORSMiddleware in your Gradio server code to remove the condition that skips origin validation for requests with cookies.

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 entries