CVE-2024-47084
JSON

6.9medium

CORS origin validation is not performed when the request has a cookie in Gradio

Severity
6.9medium CVSS:4.0 by GitHub_M
Exploit likelihood
0.53% (higher than 46% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-3c67-5hwx-f6wxPYSEC-2024-196

Description

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

Affected

Product or packageVersionsReported by
gradio-app gradio< 4.44CVE List
gradio_project gradiobefore 4.44, before 4.44.0CVE List, NVD
gradio (PyPI)before 4.44.0GitHub Advisory Database, PyPA Advisory Database

All scores

GitHub_M6.9medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N
GitHub8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
NVD8.3high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L
PyPA Advisory Database8.3high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L

Classification

CWE-285CWE-346

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

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

GitHub Advisory Database
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.

NVD (es)

Gradio es un paquete Python de código abierto diseñado para la creación rápida de prototipos. Esta vulnerabilidad está relacionada con la **validación de origen CORS**, donde el servidor Gradio no puede validar el origen de la solicitud cuando hay una cookie presente. Esto permite que el sitio web de un atacante realice solicitudes no autorizadas a un servidor Gradio local. Potencialmente, los atacantes pueden cargar archivos, robar tokens de autenticación y acceder a los datos del usuario si la víctima visita un sitio web malicioso mientras está conectado a Gradio. Esto afecta a los usuarios que han implementado Gradio localmente y usan autenticación básica. Se recomienda a los usuarios que actualicen a `gradio&gt;4.44` para solucionar este problema. Como workaround, los usuarios pueden aplicar manualmente una validación de origen CORS más estricta modificando la clase `CustomCORSMiddleware` en su código de servidor Gradio local. Específicamente, pueden omitir la condición que omite la validación CORS para las solicitudes que contienen cookies para evitar una posible explotación.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-47084 changed 2024-10-11CVE Terms of Use
GitHub Advisory DatabaseGHSA-3c67-5hwx-f6wx changed 2025-01-21CC-BY-4.0
NVDCVE-2024-47084 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2024-196 changed 2025-01-19CC-BY-4.0