/

CVE-2026-59806

Severity:

HIGH RISK

(7.4)

Open Redirect & SSRF (CWE-601/918) in Gradio API

CVE-2026-59806

Deferred

Vulnerability type

Category:

Open Redirect and Server-Side Request Forgery

CWE:

CWE-601, CWE-918

Impact:

Credential Exposure and Internal Service Access

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Gradio before 6.20.0 exposes an open redirect and server-side request forgery risk via the /gradio_api/file= endpoint's file_fetch() handling of unvalidated URLs.

By supplying crafted HTTP/HTTPS URLs, an attacker can redirect users to arbitrary sites or coerce the server into making requests to internal services, potentially leaking sensitive cloud credentials.

Affected context

This vulnerability appears in Gradio deployments that expose the /gradio_api/file= endpoint and rely on file_fetch() to retrieve remote resources over HTTP or HTTPS.

The risk is higher when the Gradio server has network access to internal resources such as cloud metadata endpoints, private APIs, or management interfaces.

Environments that treat URLs from user input as trusted without additional validation or isolation are more likely to be affected.

Exploit preconditions

  • Attack surface: Publicly accessible Gradio instances exposing /gradio_api/file=.
  • Required access: Ability to supply or influence the URL parameter passed to file_fetch(), typically via UI controls, API calls, or embedded links.
  • Trigger point: The server processes the provided HTTP/HTTPS URL and fetches the remote content without adequate validation or restriction.
  • Why exploitation is possible: URL inputs are treated as trusted, allowing requests to arbitrary domains and internal network addresses, and enabling redirection logic that forwards users to attacker-controlled destinations.

Why this happens

The underlying issue stems from insufficient validation and restriction of user-supplied URLs in the file_fetch() function.

For SSRF (CWE-918), the server accepts arbitrary HTTP/HTTPS URLs and initiates outbound requests on behalf of the user, without enforcing allowlists, blocking internal address ranges, or restricting access to sensitive metadata services.

For open redirect (CWE-601), user-controlled URLs are used in redirect flows without checking whether the destination is safe or belongs to a trusted origin.

Together, these insecure patterns allow attackers to leverage Gradio as a proxy into internal networks and to misdirect users to malicious sites.

Potential impact

  • Attackers may retrieve cloud instance metadata, including IAM role or access credentials.
  • Attackers could access internal HTTP-based services not directly exposed to the internet.
  • Users can be redirected to phishing pages, malware-hosting sites, or credential-harvesting domains.
  • Session tokens, API keys, or other sensitive configuration data available via internal endpoints may be exposed.
  • The Gradio server can be abused as a pivot point for further internal reconnaissance.

General mitigation guidance

Mitigation typically involves reducing trust in user-supplied URLs and enforcing strict network access controls from server-side components.

Common defensive patterns include:

  • Applying robust URL validation, including scheme checks and domain allowlists for remote resource fetching.
  • Blocking requests to link-local, loopback, private IP ranges, and well-known cloud metadata endpoints from application-level HTTP clients.
  • Decoupling user input from redirect targets, using fixed or mapped internal URLs instead of directly redirecting to arbitrary user-provided destinations.
  • Running application services with least-privilege network permissions and avoiding unnecessary access to internal management interfaces or metadata services.
  • Introducing proxy or gateway layers with outbound request policies to constrain what the application can reach.

How teams detect issues like this

Detection can focus on both code-level patterns and runtime behavior:

  • Static analysis and code review to flag functions that perform outbound HTTP requests using user-controlled URL parameters without validation or filtering.
  • Identification of redirect logic where user input directly populates Location headers or redirect targets.
  • Logging and monitoring of outbound HTTP traffic from the application, especially calls to metadata endpoints, internal IP ranges, or unusual domains.
  • Enforcing security policies in CI/CD that require validation of external URLs and restrict SSRF-prone patterns, potentially supported by automated scanning tools.

Sources

SourceLink
github.comgithub.com/gradio-app/gradio/commit/1c5c53842df9c2750552d85c19a92e7e732cff3f
github.comgithub.com/gradio-app/gradio/issues/13593
github.comgithub.com/gradio-app/gradio/pull/13596
github.comgithub.com/gradio-app/gradio/releases/tag/gradio%406.20.0
vulncheck.comvulncheck.com/advisories/gradio-open-redirect-and-ssrf-via-gradio-api-file-endpoint

Frequently asked

questions

Exploitability depends on external exposure of the /gradio_api/file= endpoint and the server's network reach. If the Gradio instance is internet-facing and can access internal or metadata services, attackers can abuse it from anywhere with network access to the service.

An attacker generally needs only the ability to supply or influence URL input to file_fetch(), such as via a public Gradio interface or API call. No privileged authentication is required if the endpoint is open to anonymous users.

The safest approach is to strictly validate and constrain URLs used by server-side HTTP clients, employ allowlists for permitted domains, block internal address ranges and metadata services, and avoid using user-provided URLs directly in redirect responses.

Future designs should treat all user-supplied URLs as untrusted, route outbound requests through controlled proxies with policy enforcement, implement robust redirect validation, and integrate SSRF and open redirect checks into regular security reviews and automated testing.

Find out what's already
exploitable in your codebase.