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-28415
4.30.03%

Open Redirect in Gradio OAuth Flow Enables Phishing Attacks

Alon Barad
Alon Barad
Software Engineer

Mar 1, 2026·5 min read·10 visits

PoC Available

Executive Summary (TL;DR)

Gradio versions prior to 6.6.0 contain an Open Redirect vulnerability in the OAuth login/logout endpoints. Attackers can manipulate the `_target_url` parameter to redirect users to malicious external domains. This is patched in version 6.6.0 by enforcing relative path redirects.

A security vulnerability has been identified in Gradio, a popular Python library for building machine learning demonstrations. The flaw exists within the OAuth authentication workflow, specifically in the `_redirect_to_target` function found in `gradio/oauth.py`. This function fails to properly validate the `_target_url` query parameter before issuing an HTTP 302 redirect. Consequently, an unauthenticated attacker can craft malicious URLs that leverage the trust of a legitimate Gradio application domain (such as those hosted on Hugging Face Spaces) to redirect users to arbitrary external sites. This mechanism is frequently employed in phishing campaigns to harvest credentials or distribute malware by masking the destination behind a trusted domain.

Vulnerability Overview

Gradio is an open-source Python package widely used for creating and sharing machine learning applications, particularly within the Hugging Face ecosystem. The library provides built-in authentication mechanisms via OAuth to secure these applications. A vulnerability was discovered in how the library handles post-authentication and post-logout redirects.

The specific flaw is an Open Redirect (CWE-601) located in the _redirect_to_target function. This function is responsible for guiding the user's browser to a specific page after a login or logout action completes. By default, it accepts a target URL from the incoming request's query parameters.

Because the application fails to validate whether the destination URL resides within the application's own domain, an attacker can manipulate this parameter. This allows them to generate links that appear to originate from a trusted domain (e.g., myapp.hf.space) but actually redirect the victim to an attacker-controlled site immediately after interaction.

Root Cause Analysis

The root cause of this vulnerability is the direct, unsanitized usage of user-controlled input in an HTTP response header. The vulnerable logic resides in gradio/oauth.py within the _redirect_to_target helper function.

In the vulnerable versions, the function retrieves the _target_url query parameter from the FastAPI request object and passes it directly to the RedirectResponse constructor. The RedirectResponse class in Starlette/FastAPI sets the Location header to the provided string and issues a 302 Found status code.

The code does not check if the URL is absolute (containing a scheme and hostname) or relative. The lack of an allowlist or domain validation means that any valid URL string is accepted. If an attacker supplies https://evil.com, the server explicitly instructs the browser to navigate there, treating the external domain as a valid destination for the application flow.

Code Analysis: Vulnerable vs. Patched

The remediation involves parsing the input URL and stripping out the scheme (protocol) and network location (hostname), effectively forcing all redirects to be relative to the application's root.

Vulnerable Code (gradio/oauth.py):

def _redirect_to_target(
    request: fastapi.Request, default_target: str = "/"
) -> RedirectResponse:
    # VULNERABLE: Takes the parameter directly from the request
    target = request.query_params.get("_target_url", default_target)
    # Returns a 302 Redirect to the exact string provided
    return RedirectResponse(target)

Patched Code (Fixed in v6.6.0):

import urllib.parse
 
def _redirect_to_target(
    request: fastapi.Request, default_target: str = "/"
) -> RedirectResponse:
    target = request.query_params.get("_target_url", default_target)
    
    # PATCH: Parse the URL to inspect its components
    parsed = urllib.parse.urlparse(target)
    
    # Construct a 'safe' target using only the path, query, and fragment.
    # This discards 'scheme' (http/https) and 'netloc' (domain.com).
    safe_target = parsed.path or "/"
    if parsed.query:
        safe_target += "?" + parsed.query
    if parsed.fragment:
        safe_target += "#" + parsed.fragment
        
    return RedirectResponse(safe_target)

This robust fix ensures that even if an attacker supplies https://evil.com/login, urllib.parse separates the components. The logic then reconstructs the URL using only the path /login, keeping the user on the legitimate site.

Exploitation Scenarios

Exploitation of CVE-2026-28415 requires user interaction but is trivial to execute. The attacker needs to craft a URL pointing to a vulnerable Gradio instance's logout or login callback endpoints.

Attack Scenario:

  1. Preparation: The attacker sets up a phishing page at https://evil-login.com that mimics the look and feel of the target Gradio app or Hugging Face login.
  2. Delivery: The attacker sends a phishing email or message containing a link: https://trusted-app.hf.space/logout?_target_url=https://evil-login.com.
  3. Execution: The victim clicks the link. They see the domain trusted-app.hf.space and trust it. The application processes the logout request and immediately responds with Location: https://evil-login.com.
  4. Compromise: The browser automatically follows the redirect. The user, believing they simply logged out, may see a fake "Session Expired, Please Login Again" prompt on the attacker's site and enter their credentials.

This vector is particularly effective because security training often emphasizes checking the domain of the initial link. Since the initial link is legitimate, it bypasses basic user scrutiny.

Impact Assessment

While Open Redirect vulnerabilities do not directly allow for Remote Code Execution (RCE) or database access, they are a critical enabler for sophisticated social engineering attacks.

Trust Exploitation: The primary impact is the weaponization of the organization's reputation. Security controls like email filters often allowlist known domains (e.g., *.hf.space). An open redirect allows malicious payloads to ride on these allowlisted domains.

OAuth Token Leakage: In some OAuth misconfigurations, if the redirect occurs during the authorization phase and the attacker controls the redirect URI, it may be possible to leak authorization codes or access tokens via the Referer header or direct URL parameters, although the patch here specifically addresses the destination after the flow completes.

CVSS Context: The assigned score of 4.3 (Medium) reflects that while the technical impact on the server is nil (Integrity: Low, Confidentiality: None), the requirement for user interaction and the limitation to client-side redirection constrains the severity.

Official Patches

GradioOfficial Fix Commit

Fix Analysis (1)

Technical Appendix

CVSS Score
4.3/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
EPSS Probability
0.03%
Top 92% most exploited

Affected Systems

Gradio < 6.6.0

Affected Versions Detail

Product
Affected Versions
Fixed Version
Gradio
Gradio
< 6.6.06.6.0
AttributeDetail
CWE IDCWE-601
Attack VectorNetwork
CVSS v3.14.3 (Medium)
ImpactPhishing / Redirect
Exploit StatusPoC Available
EPSS Score0.00028 (Low)

MITRE ATT&CK Mapping

T1566.002Spearphishing Link
Initial Access
T1204.001User Execution: Malicious Link
Execution
CWE-601
Open Redirect

URL Redirection to Untrusted Site ('Open Redirect')

Known Exploits & Detection

GitHubRegression tests included in the patch demonstrate the exploit vector.

Vulnerability Timeline

Patch committed to main branch
2026-02-17
Gradio v6.6.0 released
2026-02-27
Vulnerability Disclosed (CVE-2026-28415)
2026-02-27

References & Sources

  • [1]GitHub Security Advisory
  • [2]NIST NVD Entry

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.