/

CVE-2026-28414

Severity:

HIGH RISK

(7.5)

Path Traversal in Gradio on Windows with Python 3.13+

CVE-2026-28414

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-36, CWE-22

Impact:

Arbitrary File Read

Severity:

HIGH RISK

(7.5)

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 apps running on Windows with Python 3.13+ are affected by an absolute path traversal issue that allows unauthenticated attackers to read arbitrary files from the server's file system.

A change in Python's os.path.isabs behavior causes Gradio's path-joining safety checks to misclassify root-relative paths, enabling crafted requests to bypass protections and access sensitive files, even when application-level authentication is enabled.

Affected context

This vulnerability affects Gradio applications that:

  • Run on Windows operating systems
  • Use Python 3.13 or later
  • Rely on Gradio's file-serving logic that uses os.path.isabs to validate paths

The issue is most relevant in deployments where Gradio exposes file download or static file endpoints and is reachable over the network, including setups that also configure additional authentication layers in front of Gradio.

Exploit preconditions

  • Attack surface: Network-accessible Gradio endpoints that return files or serve static content.
  • Required access: No prior authentication is required; unauthenticated HTTP requests can reach the vulnerable logic, even if Gradio's own auth is configured.
  • Trigger point: User-controlled path or filename parameters are combined with a base directory and validated using os.path.isabs before file access.
  • Why exploitation is possible: On Windows with Python 3.13+, root-relative paths like /windows/win.ini are no longer treated as absolute by os.path.isabs. Gradio's logic assumes that non-absolute paths are safe when joined with a base directory. Attackers can therefore supply crafted root-relative paths that bypass the absolute-path check and cause the server to open files outside the intended directory.

Why this happens

The root cause is a path traversal bug stemming from incorrect assumptions about standard library behavior on Windows.

Gradio's path validation logic uses os.path.isabs to distinguish absolute from relative paths and relies on this distinction to prevent access outside of a configured base directory.

With Python 3.13+, os.path.isabs changed its semantics on Windows, and root-relative paths (e.g., /windows/win.ini) no longer count as absolute.

This mismatch between Gradio's security assumptions and the underlying API behavior maps to:

  • CWE-36: Absolute Path Traversal, where user input influences file system paths without robust canonicalization and restriction.
  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), because the application attempts but fails to constrain file access to a specific directory.

The abstract insecure pattern is trusting a single path API (such as isabs) as a security decision point instead of performing full normalization, canonicalization, and strict directory boundary checks.

Potential impact

  • Attackers can read arbitrary files accessible to the Gradio process, including configuration files, logs, and source code.
  • Exposure of secrets stored on disk, such as API keys, database credentials, or access tokens.
  • Disclosure of system-specific files (e.g., Windows configuration files) that may aid in further compromise.
  • Information leakage that facilitates other attacks such as lateral movement, privilege escalation, or targeted exploitation in the environment.

General mitigation guidance

Effective mitigation focuses on robust file path handling and defense-in-depth around file access:

  • Implement strict directory whitelisting: resolve requested file paths to their canonical form and enforce that they reside within a designated root directory before opening.
  • Avoid relying solely on os.path.isabs or similar APIs for security decisions; use comprehensive normalization (realpath/abspath) followed by directory boundary checks.
  • Treat any user-controlled path segment (including query parameters, URL segments, and form fields) as untrusted and validate against a known safe list of filenames or IDs where possible.
  • Segregate sensitive files and secrets from directories exposed to Gradio or any file-serving functionality.
  • Run Gradio with least-privilege file system permissions so the process cannot read highly sensitive system or application files that are not needed for normal operation.
  • Consider using indirection (e.g., mapping opaque file identifiers to approved files) rather than passing raw paths or filenames from clients.

How teams detect issues like this

Path traversal issues can often be detected before deployment through a combination of review and automated checks:

  • Static analysis: Configure SAST tools or custom rules to flag uses of user-supplied input in file operations (open, os.path.join, Path.open) without canonicalization and directory containment checks.
  • Code review: Look for patterns where:
  • User input directly or indirectly influences file paths.
  • Security checks rely on os.path.isabs, prefix checks, or naive string operations (like startswith) instead of true canonical path validation.
  • There is an assumption that "relative" paths are automatically safe when joined with a base directory.
  • Dynamic testing: Employ security tests or DAST scanners that attempt path traversal payloads, including platform-specific forms like /windows/win.ini or ..\..\ patterns, to verify that the app consistently rejects out-of-scope file requests.
  • Policy enforcement: Incorporate secure file-access wrapper utilities that encapsulate canonicalization and directory checks, and enforce their use via code review guidelines or automated linting.

Sources

SourceLink
github.comgithub.com/gradio-app/gradio/security/advisories/GHSA-39mp-8hj3-5c49

Frequently asked

questions

Yes. Any attacker who can send HTTP requests to the affected Gradio instance on Windows with Python 3.13+ may exploit this issue to read files, without needing valid credentials.

No. The vulnerability can be triggered by unauthenticated users. Even if Gradio is configured with authentication, the underlying path validation flaw can still allow attackers to bypass intended access controls for file reads.

The most robust fix is to perform canonical path resolution followed by strict directory boundary enforcement. Resolve the requested path to its absolute, normalized form and then verify it is within an approved root directory; deny or log any request that falls outside that boundary. Avoid using isabs or simple string checks as the primary security control.

Establish a standard file-access abstraction that:

  • Accepts only vetted identifiers or filenames instead of arbitrary paths.
  • Performs canonicalization and directory checks in one place.
  • Is covered by automated tests, including platform-specific edge cases.

Combine this with security-aware code review practices and static analysis rules that flag direct file access based on user input or reliance on fragile path-checking APIs.

Find out what's already
exploitable in your codebase.