CVE-2026-27167
None · 0.0CVSS
0.0
EPSS
0.4%
Published
Feb 27, 2026
CISA due date
—
Cloudanix analysis
Some Gradio demo apps can accidentally hand the app owner’s Hugging Face access token to anyone who visits a special login URL.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Moderate
- Impact
- Data Exposure
- Component
- Library
- Class
- Credential Exposure
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Medium
What it actually does
Gradio versions 4.16.0 through versions before 6.6.0 can expose the server-side Hugging Face access token when an application runs outside Hugging Face Spaces and uses OAuth UI components such as `gr.LoginButton`. In that configuration, Gradio automatically enables mocked OAuth routes. A remote unauthenticated requester can access `/login/huggingface`, causing the server to call `huggingface_hub.get_token()` and place the server owner's Hugging Face token into the requester’s session cookie. The cookie is signed with a hardcoded secret derived from `"-v4"`, so the attacker can decode or validate the session payload and recover the token. The direct impact is credential disclosure rather than code execution; downstream impact depends on the permissions associated with the exposed Hugging Face token.
Why it matters to the business
A network-exposed Gradio application using affected OAuth components may leak the application owner’s Hugging Face token to anyone who can reach the login route. If that token has access to private models, datasets, organizations, or write permissions, an attacker could read confidential assets, alter hosted content, poison models or datasets, disrupt ML workflows, or use the token for unauthorized API activity. This issue is not currently listed in CISA KEV, is not known to be used in ransomware campaigns, and has low EPSS, but the remediation should still be prioritized for externally reachable Gradio apps because exploitation requires no account and can directly expose reusable credentials.
How an attack unfolds
An attacker first identifies a network-accessible Gradio application that is running an affected version and includes Hugging Face OAuth-related components. The attacker sends a request to the mocked OAuth login endpoint, typically `/login/huggingface`. Instead of requiring a legitimate Hugging Face OAuth exchange, the vulnerable Gradio server retrieves its own local Hugging Face token using `huggingface_hub.get_token()` and serializes that token into the HTTP session cookie returned to the requester. Because the session cookie signing secret is hardcoded and publicly derivable from `"-v4"`, the attacker can decode the cookie payload and extract the Hugging Face token. The attacker can then use the token against Hugging Face APIs, Git operations, or model and dataset endpoints according to the token’s scope.
How to fix it
Upgrade Gradio to version 6.6.0 or later. For source-based deployments, update to a fixed commit at or after `89841593255f57cbb19da099b6e753110b1b99af`. Prioritize externally reachable Gradio applications and any deployment using OAuth components such as `gr.LoginButton`. If immediate upgrade is not possible, remove or disable Hugging Face OAuth components, block external access to `/login/huggingface`, place the application behind authentication or network allowlisting, and avoid running Gradio with a privileged Hugging Face token present in the runtime environment. Rotate any Hugging Face token that may have been exposed, especially tokens with organization, private repository, write, admin, model, dataset, or Space permissions. After rotation, invalidate old credentials and review Hugging Face account and organization activity for unauthorized access.
How to confirm the fix worked
Confirm the installed Gradio version is 6.6.0 or later, or that the deployed source includes commit `89841593255f57cbb19da099b6e753110b1b99af` or a later fix. Test a non-production or authorized instance by requesting `/login/huggingface` without authentication and verifying that the server does not place any Hugging Face token or token-like value in a returned session cookie. Review dependency lockfiles, container images, Python environments, and build artifacts for `gradio` versions from 4.16.0 through versions before 6.6.0. Confirm that externally reachable routes no longer expose mocked OAuth behavior and that old Hugging Face tokens have been rotated. Validate compensating controls by ensuring direct requests to `/login/huggingface` are denied, redirected to a real authentication flow, or unavailable where OAuth is not intentionally used.
Typical attack path
- Discover an internet-accessible or internally reachable Gradio application.
- Determine that the application exposes Hugging Face OAuth functionality or test for the mocked OAuth route.
- Send an unauthenticated request to `/login/huggingface`.
- Capture the HTTP response containing the session cookie.
- Decode or verify the cookie using the known hardcoded signing secret derived from `"-v4"`.
- Extract the embedded Hugging Face access token from the cookie payload.
- Use the token to access or modify Hugging Face resources allowed by the token’s permissions.
- Optionally pivot to related repositories, models, datasets, Spaces, or organization resources accessible with the token.
How to detect it
To determine whether exploitation already occurred, review HTTP access logs, reverse proxy logs, load balancer logs, WAF logs, and application logs for requests to `/login/huggingface` on affected Gradio services. Focus on unauthenticated requests, external source IPs, scanner-like user agents, direct requests without normal application navigation, repeated probing, and responses that set a session cookie. Correlate any suspicious requests with Hugging Face account, organization, API, Git, model, dataset, and Space activity shortly afterward. Look for new or unexpected repository clones, pushes, model or dataset downloads, file modifications, Space deployments, token-authenticated API calls, permission changes, or access from unfamiliar IP addresses. On affected hosts, review process environments, secret stores, container definitions, and runtime configuration to identify which Hugging Face token could have been exposed, then compare its last-used timestamps and audit history. Because the credential is returned to the attacker in an HTTP cookie, endpoint forensic artifacts may be minimal unless web response headers, proxy telemetry, or full packet capture were retained.
- /login/huggingface
- GET /login/huggingface
- POST /login/huggingface
- "/login/huggingface" 200
- "/login/huggingface" 302
- Set-Cookie: session=
- huggingface
- gr.LoginButton
- gradio==4.16.0
- gradio==4.17.0
- gradio==4.18.0
- gradio==4.19.0
- gradio==4.20.0
- gradio==4.21.0
- gradio==4.22.0
- gradio==4.23.0
- gradio==4.24.0
- gradio==4.25.0
- gradio==4.26.0
- gradio==4.27.0
- gradio==4.28.0
- gradio==4.29.0
- gradio==4.30.0
- gradio==4.31.0
- gradio==4.32.0
- gradio==4.33.0
- gradio==4.34.0
- gradio==4.35.0
- gradio==4.36.0
- gradio==4.37.0
- gradio==4.38.0
- gradio==4.39.0
- gradio==4.40.0
- gradio==4.41.0
- gradio==4.42.0
- gradio==4.43.0
- gradio==4.44.0
- gradio==5.
- hf_
What your security team should do
- Inventory Gradio applications and identify deployments running versions 4.16.0 through before 6.6.0, especially those exposed to the internet or broad internal networks.
- Upgrade affected deployments to Gradio 6.6.0 or later, or rebuild from a source version containing commit `89841593255f57cbb19da099b6e753110b1b99af` or later.
- Immediately rotate Hugging Face tokens present on affected servers, prioritizing tokens with write, organization, private repository, dataset, model, or Space permissions.
- Search web access logs for unauthenticated or unusual requests to `/login/huggingface`, especially from external IP addresses, scanners, or clients with no normal user activity.
- Review Hugging Face audit logs, token usage, repository events, model and dataset changes, API activity, and Git access around any suspicious login-route requests.
- If upgrade is delayed, block `/login/huggingface`, remove OAuth components, restrict network exposure, and run Gradio services with least-privilege or no Hugging Face token where possible.
- Add dependency scanning or software composition analysis rules to flag affected Gradio versions in applications, notebooks, containers, and ML demo services.
The record
Gradio is an open-source Python package designed for quick prototyping. Starting in version 4.16.0 and prior to version 6.6.0, Gradio applications running outside of Hugging Face Spaces automatically enable "mocked" OAuth routes when OAuth components (e.g. `gr.LoginButton`) are used. When a user visits `/login/huggingface`, the server retrieves its own Hugging Face access token via `huggingface_hub.get_token()` and stores it in the visitor's session cookie. If the application is network-accessible, any remote attacker can trigger this flow to steal the server owner's HF token. The session cookie is signed with a hardcoded secret derived from the string `"-v4"`, making the payload trivially decodable. Version 6.6.0 fixes the issue.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| PyPI | gradio | 4.16.0 | 6.6.0 |
Related vulnerabilities
- GHSA-h3h8-3v2v-rg7m Gradio: Mocked OAuth Login Exposes Server Credentials and Uses Hardcoded Session Secret Same vulnerability
- GHSA-jmh7-g254-2cq9 Gradio has SSRF via Malicious `proxy_url` Injection in `gr.load()` Config Processing Also affects gradio
- GHSA-pfjf-5gxr-995x Gradio has an Open Redirect in its OAuth Flow Also affects gradio
- GHSA-39mp-8hj3-5c49 Gradio is Vulnerable to Absolute Path Traversal on Windows with Python 3.13+ Also affects gradio
- CVE-2026-28414 Gradio is an open-source Python package designed for quick prototyping. Also affects gradio
- CVE-2026-28415 Gradio is an open-source Python package designed for quick prototyping. Also affects gradio
- CVE-2026-28416 Gradio is an open-source Python package designed for quick prototyping. Also affects gradio
- CVE-2025-5320 A vulnerability classified as problematic has been found in gradio-app gradio up to… Also affects gradio