CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-27167

Critical Credential Leakage and Open Redirect in Gradio OAuth Flow

Amit Schendel
Amit Schendel
Senior Security Researcher

Mar 1, 2026·5 min read·44 visits

Executive Summary (TL;DR)

Gradio versions prior to 6.6.0 leak the server's Hugging Face access token via insecurely signed session cookies in the mocked OAuth flow. Attackers can decrypt the session to steal credentials or use an open redirect for phishing.

A critical vulnerability in the Gradio Python package allows unauthenticated remote attackers to extract sensitive Hugging Face access tokens from the server environment. The flaw exists in the 'mocked' OAuth implementation used when the application runs outside of Hugging Face Spaces. Additionally, an open redirect vulnerability facilitates phishing attacks. These issues are resolved in version 6.6.0.

Vulnerability Overview

CVE-2026-27167 describes a critical security failure in gradio, a popular Python library for building machine learning demonstrations. The vulnerability specifically affects the OAuth authentication flow when the application is hosted in environments other than Hugging Face Spaces (e.g., local development, on-premise servers, or third-party clouds).

When running in these environments, Gradio defaults to a 'mocked' OAuth flow to simulate authentication without requiring a full provider configuration. However, this implementation contained a severe logic error: it retrieved the actual Hugging Face authentication token from the server's environment (specifically HF_TOKEN) and embedded it into the user's session cookie. Combined with a weak, predictable signing key for the session cookie, this allows remote attackers to recover the plaintext credentials.

Furthermore, the login endpoint failed to validate the _target_url parameter, enabling an Open Redirect (CWE-601). This allows attackers to craft URLs that appear to be legitimate authentication links but redirect victims to malicious domains after the mock login completes.

Root Cause Analysis

The vulnerability stems from three converging failures in gradio/oauth.py:

1. Insecure Default Credential Usage (CWE-522) The function _get_mocked_oauth_info was designed to provide dummy user data for the mocked login flow. Instead of returning static placeholder data, the implementation called huggingface_hub.get_token(). This function retrieves the active authentication token from the server's environment variables or local cache. Consequently, the server's identity credential was serialized into the access_token field of every user session.

2. Predictable Cryptographic Signing Key (CWE-321) Gradio uses signed cookies to store session state. The signing key is derived from the application's secret. In the mocked flow, if the developer did not explicitly set an OAUTH_CLIENT_SECRET, the application defaulted to a derived key that often resolved to the string "-v4" (or app_secret + "-v4" where app_secret was empty or predictable). This low-entropy secret allows attackers to easily forge or decrypt session cookies offline.

3. Unvalidated Redirect Target (CWE-601) The _redirect_to_target function accepted a _target_url query parameter and passed it directly to fastapi.responses.RedirectResponse. Lacking any validation or sanitization, the application would honor redirects to external schemas (e.g., https://evil.com), facilitating phishing attacks leveraged against the trusted domain of the Gradio app.

Code Analysis

The patch introduced in version 6.6.0 addresses the vulnerability by replacing the dynamic token retrieval with a static string and enforcing strict URL parsing on redirects.

Credential Leakage Fix

In the vulnerable version, the code actively fetched the environment token:

# Vulnerable: gradio/oauth.py
def _get_mocked_oauth_info() -> dict:
    # DANGEROUS: Fetches the actual server token
    token = huggingface_hub.get_token()
    return {
        "access_token": token,
        "user": {"username": "user", "id": "1"}
    }

The patched version replaces this with a safe constant:

# Fixed: gradio/oauth.py
def _get_mocked_oauth_info() -> dict:
    # SAFE: Returns a static placeholder string
    return {
        "access_token": "mock-oauth-token-for-local-dev",
        "user": {"username": "user", "id": "1"}
    }

Open Redirect Fix

The redirection logic was updated to strip the domain and scheme, forcing all redirects to be relative to the application root:

# Fixed: gradio/oauth.py
import urllib.parse
 
def _redirect_to_target(request: Request, default_target: str = "/") -> RedirectResponse:
    target = request.query_params.get("_target_url", default_target)
    # PATCH: Parse the URL and reconstruct only the path and query
    parsed = urllib.parse.urlparse(target)
    safe_target = parsed.path or "/"
    if parsed.query:
        safe_target += "?" + parsed.query
    return RedirectResponse(safe_target)

Exploitation Methodology

An attacker can exploit this vulnerability without authentication if the Gradio server is accessible over the network. The attack chain proceeds as follows:

  1. Initiate Login: The attacker sends a GET request to http://<target>/login/huggingface. The _target_url parameter is optional but can be used to test the Open Redirect simultaneously.
  2. Capture Session: The server responds with a 307 Temporary Redirect (or similar) and sets a session cookie. This cookie contains the base64-encoded and signed session data.
  3. Decrypt Session: Because the signing key in the mocked flow is often the trivial string "-v4", the attacker can use a tool like itsdangerous or a simple Python script to unsign the cookie without needing a brute-force attack.
  4. Extract Token: The decoded session payload is a JSON object. The attacker reads the access_token field. In vulnerable versions, this field contains the server's live HF_TOKEN.
  5. Pivot: The attacker uses the stolen HF_TOKEN to authenticate against the Hugging Face API, potentially accessing private repositories, modifying models, or poisoning datasets associated with the server owner's account.

Impact Assessment

The impact of this vulnerability is Critical due to the high value of the compromised credentials.

  • Confidentiality (High): The leaked HF_TOKEN may belong to a user with administrative privileges or write access to high-value models and datasets. Exposure allows unauthorized access to intellectual property and sensitive training data.
  • Integrity (High): With write access, an attacker could inject malicious code into machine learning models (model poisoning) or modify dataset contents, leading to supply chain attacks downstream.
  • Availability (Low): While the primary risk is data theft, an attacker could delete private repositories, causing service disruption.

Likelihood: The exploitation difficulty is Low (AC:L) because the signing key is predictable by default in the affected configuration. The vector is Network (AV:N) and requires no privileges (PR:N).

Official Patches

GradioGitHub Commit: Fix logic in oauth.py
GitHub AdvisoryGHSA-h3h8-3v2v-rg7m

Fix Analysis (1)

Technical Appendix

CVSS Score
9.1/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
EPSS Probability
0.04%
Top 100% most exploited

Affected Systems

Gradio Python package versions >= 4.16.0 and < 6.6.0Applications using `gr.LoginButton` or OAuth features outside of Hugging Face Spaces

Affected Versions Detail

Product
Affected Versions
Fixed Version
gradio
Gradio
>= 4.16.0, < 6.6.06.6.0
AttributeDetail
CWE IDCWE-522 (Insufficiently Protected Credentials)
CWE IDCWE-601 (Open Redirect)
CVSS v3.19.1 (Critical)
Attack VectorNetwork
Exploit StatusPoC Available
Patch Date2026-02-17

MITRE ATT&CK Mapping

T1552.001Unsecured Credentials: Credentials in Files
Credential Access
T1204.001User Execution: Malicious Link
Execution
T1539Steal Web Session Cookie
Credential Access
CWE-522
Insufficiently Protected Credentials

The application transmits credentials to an actor that is not authorized to see them, or stores credentials in a location that is accessible to unauthorized actors.

Known Exploits & Detection

N/AAdvisory implies trivial exploitation via session cookie decoding.

Vulnerability Timeline

Fix committed to main branch
2026-02-17
CVE Published / Advisory Released
2026-02-27

References & Sources

  • [1]NVD - CVE-2026-27167
  • [2]GitHub Advisory

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 5 hours ago•CVE-2026-50751
9.3

CVE-2026-50751: Authentication Bypass in Check Point Security Gateway IKEv1 Legacy Validation

An improper authentication vulnerability (CWE-287) exists in the legacy, deprecated Internet Key Exchange version 1 (IKEv1) key exchange protocol implementation in Check Point Security Gateways. The vulnerability is caused by a logic flow weakness during the certificate validation process for Remote Access VPN and Mobile Access (SSL VPN) connections. An unauthenticated remote attacker can exploit this weakness to bypass user authentication entirely, establishing a fully functional Remote Access VPN connection without a valid password.

Alon Barad
Alon Barad
24 views•6 min read
•about 18 hours ago•CVE-2026-39922
6.3

CVE-2026-39922: Server-Side Request Forgery in GeoNode Service Registration Endpoint

GeoNode versions prior to 4.4.5 and 5.0.2 are vulnerable to Server-Side Request Forgery (SSRF) in the service registration endpoint. Authenticated attackers with low privileges can exploit insufficient input validation in the Web Map Service (WMS) registration module to force the application server to make outbound network queries to loopback addresses, private RFC1918 subnets, link-local scopes, and cloud metadata endpoints. This technical report details the mechanics of the vulnerability, the underlying architectural flaw, and how to effectively remediate and mitigate the associated security risks.

Alon Barad
Alon Barad
4 views•7 min read
•1 day ago•CVE-2022-0492
7.8

CVE-2022-0492: Privilege Escalation and Container Escape via cgroups v1 release_agent

CVE-2022-0492 is a high-severity missing authorization vulnerability in the Linux kernel's Control Groups (cgroups) v1 implementation. The flaw resides within the cgroup_release_agent_write function in kernel/cgroup/cgroup-v1.c, where the kernel fails to validate if the process writing to the release_agent file possesses administrative capabilities in the initial user namespace. This allows a local attacker inside a container with root privileges (UID 0) to abuse user namespaces, mount a cgroups v1 directory, modify the release_agent parameter, and execute arbitrary commands on the host system as host root, effectively achieving a complete container escape.

Amit Schendel
Amit Schendel
12 views•7 min read
•3 days ago•GHSA-G72G-R7M4-9X4G
6.3

GHSA-G72G-R7M4-9X4G: Insufficient Session Expiration of OAuth Tokens in NocoDB

NocoDB is subject to an insufficient session expiration vulnerability where OAuth access and refresh tokens are not invalidated or revoked during security-sensitive actions such as password changes, forgot-password requests, or password resets. This allows an attacker possessing an active OAuth token to maintain unauthorized persistence.

Amit Schendel
Amit Schendel
12 views•6 min read
•3 days ago•GHSA-FGMC-2HQJ-86V4
6.9

GHSA-FGMC-2HQJ-86V4: Default Administrative Credentials in vantage6-server

A vulnerability in the vantage6 federated learning framework allows unauthenticated remote attackers to gain administrative control of the server via hardcoded default credentials (root/root) when deployed under default configurations in versions 4.2.3 and below.

Amit Schendel
Amit Schendel
8 views•5 min read
•3 days ago•GHSA-X9F6-9RVM-MMRG
6.9

GHSA-X9F6-9RVM-MMRG: Improper Access Control and Volume Mount Isolation Bypass in vantage6 Node

An improper access control vulnerability in the vantage6 node component allows concurrently running algorithm containers to read and modify sensitive input and output files of other tasks. The lack of strict workspace directory isolation exposes a significant attack surface in multi-tenant or federated environments where untrusted algorithms are executed.

Amit Schendel
Amit Schendel
4 views•4 min read