Mar 1, 2026·5 min read·79 visits
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.
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.
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.
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 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:
https://evil-login.com that mimics the look and feel of the target Gradio app or Hugging Face login.https://trusted-app.hf.space/logout?_target_url=https://evil-login.com.trusted-app.hf.space and trust it. The application processes the logout request and immediately responds with Location: https://evil-login.com.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.
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.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Gradio Gradio | < 6.6.0 | 6.6.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-601 |
| Attack Vector | Network |
| CVSS v3.1 | 4.3 (Medium) |
| Impact | Phishing / Redirect |
| Exploit Status | PoC Available |
| EPSS Score | 0.00028 (Low) |
URL Redirection to Untrusted Site ('Open Redirect')
Grav CMS prior to version 1.7.53 and 2.0.0-rc.8 is vulnerable to an unauthenticated remote denial of service (DoS) vulnerability. By supplying crafted query parameters with extremely large dimensions to image assets, remote unauthenticated attackers can force the server to allocate massive amounts of system memory, leading to kernel Out-Of-Memory (OOM) termination of web worker processes.
CVE-2026-53657 is a local privilege escalation vulnerability in Lima (lima-vm/lima) affecting versions prior to 2.1.3 when configured with the QEMU driver. The guest agent daemon, running as root, creates its communication socket `/run/lima-guestagent.sock` with world-writable permissions (0777). This allows unprivileged local users to command the agent to establish arbitrary tunnels, including to privileged local UNIX sockets (like D-Bus). Because the target daemon authenticates the incoming connection using the credentials of the root-owned guest agent (via SO_PEERCRED), unprivileged users can perform root operations, resulting in complete guest VM compromise.
An unauthenticated Denial of Service vulnerability exists in the s2n-quic library's CryptoStream reassembler due to a lack of buffer limits on out-of-order cryptographic frames. An attacker can transmit a crafted CRYPTO frame with an extremely high offset and nominal payload, forcing the receiver to execute unbounded memory allocations and causing service crashes.
A JNDI Injection and Deserialization Gadget vulnerability exists in mchange-commons-java prior to version 0.6.0. The com.mchange.v2.naming.JavaBeanObjectFactory component permits arbitrary class instantiation and setter invocation, allowing attackers to perform Server-Side Request Forgery (SSRF) and remote class loading.
SurrealDB versions supporting element-level SELECT permissions on arrays are vulnerable to a logical authorization bypass. Due to an index-shifting error during array filtration, restricted elements can skip permission checks and leak to unauthorized record users.
CVE-2026-12243 is a path traversal vulnerability in the Natural Language Toolkit (NLTK) version 3.9.4. The flaw exists because the input validation routine fails to account for percent-encoded directory traversal sequences like '..%2f' before passing them to urllib.request.url2pathname(), which decodes them into active traversal sequences.