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 package | Versions | Reported by |
|---|---|---|
| gradio-app gradio | < 4.44 | CVE List |
| gradio_project gradio | before 4.44, before 4.44.0 | CVE List, NVD |
| gradio (PyPI) | before 4.44.0 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| GitHub_M | 6.9medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N |
| GitHub | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| NVD | 8.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L |
| PyPA Advisory Database | 8.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L |
Classification
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>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
| https://github.com/gradio-app/gradio/security/advisories/GHSA-3c67-5hwx-f6wx | advisory, mitigation, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2024-47084 | advisory | |
| https://github.com/gradio-app/gradio | package | |
| https://github.com/pypa/advisory-database/tree/main/vulns/gradio/PYSEC-2024-196.yaml | web | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-47084 changed 2024-10-11 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-3c67-5hwx-f6wx changed 2025-01-21 | CC-BY-4.0 |
| NVD | CVE-2024-47084 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2024-196 changed 2025-01-19 | CC-BY-4.0 |