Summary
RustFS versions 1.0.0-alpha.13 through 1.0.0-alpha.78 contain a path traversal vulnerability in the /rustfs/rpc/read_file_stream endpoint that can allow attackers to read arbitrary files on the underlying filesystem.
When user-controlled path input is not correctly normalized and constrained to a storage root, crafted requests may break out of the intended storage directory and access sensitive data.
Affected context
The vulnerability occurs in RustFS deployments that expose the /rustfs/rpc/read_file_stream endpoint and accept file path parameters from remote clients.
When these parameters are used to construct filesystem paths without robust normalization and directory confinement, requests containing traversal sequences (such as parent directory references) can escape the configured storage root and reach other parts of the server's filesystem.
This risk is most relevant in environments where RustFS runs with access to sensitive configuration files, credentials, or shared volumes.
Exploit preconditions
- Attack surface: Network-accessible /rustfs/rpc/read_file_stream endpoint exposed to clients or services.
- Required access: Ability to send requests to the RustFS RPC API (over the configured protocol/port); no additional local filesystem access is required.
- Trigger point: Invocation of the read_file_stream operation with a crafted path parameter containing directory traversal patterns or unexpected absolute/relative path constructs.
- Why exploitation is possible: The server-side implementation relies on user-supplied path input and does not sufficiently canonicalize, normalize, or constrain it to a fixed base directory, allowing the effective resolved path to point outside the intended storage root.
Why this happens
The underlying bug aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
In this class of vulnerability, an application builds filesystem paths by concatenating or otherwise combining a base directory with user-provided input, but fails to correctly:
- Normalize the path to a canonical form,
- Reject parent-directory sequences and other escape mechanisms, and
- Enforce that the final canonical path remains within an allowed directory tree.
As a result, the file read operation in /rustfs/rpc/read_file_stream can be directed at arbitrary locations on the filesystem accessible to the RustFS process.
Potential impact
- Reading of sensitive configuration files that may contain credentials, API keys, or secrets.
- Exposure of internal system files that could aid further attacks (e.g., environment details, logs).
- Disclosure of other tenants' or users' data if stored on the same host or volume.
- Assistance in privilege escalation by providing information necessary to exploit additional weaknesses.
- Weakening of overall system isolation and data confidentiality within the storage environment.
General mitigation guidance
Effective mitigation for path traversal issues generally focuses on strict path handling and directory confinement, for example:
- Treat all client-supplied path segments as untrusted and never use them directly to construct filesystem paths.
- Normalize and canonicalize the requested path (resolving
.., symbolic links as applicable, and redundant separators) before using it. - Enforce that the resolved canonical path is a descendant of an explicitly configured storage root; reject requests that escape this directory.
- Use whitelisting of allowed path patterns or object identifiers instead of passing raw filesystem paths from clients.
- Avoid exposing direct filesystem structure; consider mapping logical object IDs to internal paths that clients never control directly.
- Run the storage service with least-privilege filesystem permissions so that even if a traversal bug appears, the accessible files are constrained.
These patterns help make path handling secure-by-default and reduce the risk of similar flaws in other endpoints.
How teams detect issues like this
Detection typically involves a combination of code-centric and runtime approaches:
- Static analysis: Look for code patterns where user input (e.g., request parameters, RPC fields) is concatenated with directory strings or passed directly into file I/O APIs (open, read, stream) without canonicalization and boundary checks.
- Code review: During manual review, flag any endpoint that:
- Accepts relative or absolute paths from clients,
- Does not verify that paths remain under a configured base directory, or
- Lacks explicit rejection of
..components and other traversal constructs. - Security testing: Use dynamic application security testing (DAST) or integration tests to send crafted path values containing directory traversal patterns and verify that access outside the storage root is not possible.
- Policy and tooling: Configure automated review tools to enforce secure path-handling guidelines and block merges when unsafe path concatenation or unchecked file access patterns are detected.

