Summary
A path traversal flaw in Kestra's API URI handling allows attackers to bypass directory guards using URL-encoded .. segments in kestra:// URIs.
When an authenticated user can invoke affected endpoints with crafted URIs, they may read arbitrary files accessible to the Kestra process on the host filesystem.
Affected context
This vulnerability appears in Kestra deployments that expose API endpoints accepting kestra:// URIs and using StorageInterface.parentTraversalGuard for safety checks.
It is relevant when the Kestra process has access to sensitive files on the host (e.g., /etc/passwd, mounted secrets, tenant-specific execution outputs) and when authentication allows users to trigger a single execution against these endpoints.
The issue is tied to how URIs are validated and decoded prior to being resolved into filesystem paths, and may manifest wherever URI-encoded path segments are not normalized before use.
Exploit preconditions
- Attack surface: Kestra HTTP API endpoints that accept
kestra://URIs for storage access. - Required access: Authenticated access to Kestra with permission to invoke at least one execution or API call that reads from the local storage backend.
- Trigger point: Submission of a
kestra://URI containing URL-encoded parent directory segments (e.g.,%2E%2E) that passparentTraversalGuard, followed by downstream resolution and file open. - Why exploitation is possible: The guard checks the literal
URI.toString()and does not account for URL-encoded.., while downstream code usesURI.getPath()(which decodes%2E%2Einto..) and passes the resulting path directly toPaths.get(...)without normalization, allowing the OS to resolve the..segments at file open time.
Why this happens
The core issue is insufficient validation and normalization of user-controlled paths derived from URIs before using them in filesystem operations.
The protection logic relies on inspecting the un-decoded string representation of the URI, missing encoded traversal tokens like %2E%2E, and assumes the checked form matches the resolved path.
When URI.getPath() is later invoked, encoded sequences are decoded into .., and the resulting path is handed to Paths.get(...) without canonicalization or enforcement of a fixed root directory.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory (Path Traversal), where the application fails to constrain paths to an intended base, allowing attackers to escape the storage sandbox.
Potential impact
- An authenticated user may read arbitrary files accessible to the Kestra process on the host.
- Attackers could access system files such as
/etc/passwdand configuration files. - Secrets mounted into the Kestra environment (cloud credentials, database passwords, API keys) could be exposed.
- Other tenants' execution outputs and logs may be disclosed, leading to cross-tenant data leakage.
- Sensitive operational metadata and internal application files can be inspected to aid further attacks.
General mitigation guidance
Mitigation generally focuses on enforcing strict path constraints and robust normalization whenever user input influences filesystem access.
Recommended patterns include:
- Decoding and normalizing all URI-derived paths before applying traversal checks, ensuring validation occurs on the canonical representation.
- Enforcing a fixed storage root (jail) and rejecting any paths that resolve outside that directory, using canonical path comparison rather than string inspection alone.
- Applying explicit checks for parent directory segments after normalization, rather than relying on raw
..substring searches in the un-decoded URI. - Treating
kestra://URIs as identifiers rather than direct filesystem paths where possible, resolving them through a controlled mapping layer. - Running Kestra under least-privilege accounts and limiting access to sensitive host files to reduce impact even if a traversal occurs.
How teams detect issues like this
Organizations can detect and manage path traversal risks by:
- Using static analysis rules that flag uses of
Paths.get(...), file I/O APIs, and URI-to-path conversions where user-controlled input is not normalized or bounded by a trusted root. - Reviewing code paths around
StorageInterface, URI parsing, and guard implementations to ensure checks occur on decoded and canonicalized paths. - Implementing secure coding policies that mandate canonical path verification and deny any path escaping designated storage directories.
- Adding runtime logging for rejected or suspicious paths containing traversal markers, coupled with security monitoring for anomalous file access attempts.
- Employing automated code review tools that recognize CWE-22 patterns and highlight risky path construction or insufficient validation in pull requests.

