/

CVE-2026-49119

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in Gradio FileExplorer

CVE-2026-49119

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read / Sensitive Data Exposure

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 FileExplorer before version 6.16.0 contains a path traversal flaw that lets user-supplied path segments escape the configured root directory.

By submitting directory traversal sequences or absolute paths, an unauthenticated attacker can cause the backend to resolve paths outside the intended sandbox, leading to arbitrary file reads and exposure of sensitive files.

Affected context

This vulnerability appears when Gradio applications expose the FileExplorer component backed by the preprocess() method that uses os.path.join with user-controlled path segments.

It is most relevant in deployments where FileExplorer is available to untrusted users and the server has access to sensitive files on the filesystem, such as logs, configuration files, credentials, or application source code.

The issue manifests when path normalization and restriction to a single root directory are not enforced before resolving user-provided paths.

Exploit preconditions

  • Attack surface: HTTP interface using the Gradio FileExplorer component.
  • Required access: No authentication required; any user able to interact with the FileExplorer UI or API can supply crafted paths.
  • Trigger point: Invocation of the FileExplorer preprocess() method that joins root_dir with user-provided path segments and accesses the resulting filesystem path.
  • Why exploitation is possible: os.path.join will discard the root_dir prefix when given absolute paths and will allow traversal sequences (e.g., ../) to resolve outside the intended directory, without subsequent canonicalization or enforcement of the root boundary.

Why this happens

The root cause is improper restriction of filesystem paths derived from user-controlled input, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

In the affected FileExplorer implementation, user-supplied path segments are combined with a configured root_dir using os.path.join but are not validated, normalized, or checked to ensure the final path remains under the intended directory.

Absolute paths and traversal sequences can therefore bypass the logical sandbox, allowing the application to read arbitrary files that the process user can access.

Potential impact

  • Attackers may read arbitrary files accessible to the Gradio server process.
  • Sensitive configuration files, API keys, or credential stores could be exposed.
  • Application source code and internal logic can be disclosed, aiding further attacks.
  • Access to logs or debug artifacts may reveal session tokens or internal endpoints.
  • In some environments, exposure of environment files or SSH keys could lead to broader system compromise.

General mitigation guidance

Effective mitigation focuses on strictly constraining filesystem access to a well-defined root and treating all path input as untrusted.

Common defensive patterns include:

  • Normalizing and canonicalizing user-supplied paths before use (e.g., resolving .. segments) and verifying that the resulting path still resides under the configured root directory.
  • Rejecting absolute paths and any path that, after normalization, escapes the allowed directory tree.
  • Encapsulating file browsing functionality behind a controlled API that exposes high-level operations instead of raw path handling.
  • Running the Gradio server with least-privilege filesystem permissions so that even if traversal occurs, sensitive system paths are not readable.
  • Designing components to operate on logical resource identifiers rather than direct filesystem paths to reduce exposure to path-based attacks.

How teams detect issues like this

Detection generally relies on both preventative checks during development and monitoring in production.

Useful strategies include:

  • Static analysis rules that flag uses of os.path.join (or similar APIs) with user-controlled path segments and no subsequent root-boundary enforcement.
  • Code review practices that require explicit checks ensuring resolved paths remain under a configured base directory, and that absolute or traversal-affected paths are rejected.
  • Security testing and fuzzing of file-related endpoints, sending paths with ../, absolute paths, and URL-encoded traversal sequences to confirm they are correctly blocked.
  • Adding server-side logging and alerts when requests reference suspicious paths, such as attempts to access /etc/, home directories, or known sensitive files.

Sources

SourceLink
github.comgithub.com/gradio-app/gradio/commit/97d541f3d5fd05b2587a69ecc94b68fe5d2d7004
github.comgithub.com/gradio-app/gradio/pull/13437
github.comgithub.com/gradio-app/gradio/releases/tag/gradio%406.16.0
vulncheck.comvulncheck.com/advisories/gradio-path-traversal-via-fileexplorer-preprocess

Frequently asked

questions

It is broadly exploitable wherever the vulnerable FileExplorer component is exposed to untrusted users, because no authentication is required to submit crafted path segments that trigger traversal.

The attacker only needs network access to the Gradio application that exposes FileExplorer. They do not require valid credentials or special roles; interaction with the component's UI or API is sufficient.

The safest fix pattern is to normalize and validate all user-supplied paths, ensuring the resolved path remains under a predefined root directory, and to reject any absolute or traversal-escaping paths. Complement this with least-privilege filesystem permissions so that the process cannot read sensitive system files.

Future components should treat all file paths as untrusted input, implement strict root-boundary checks, avoid exposing direct filesystem semantics to users, and incorporate security-oriented code review and automated checks that flag path operations lacking normalization and validation.

Find out what's already
exploitable in your codebase.