Summary
A path traversal vulnerability in the lakeFS local block adapter allows authenticated users to read and write files outside their intended storage directories.
By abusing insufficient prefix-based path checks and namespace validation, an attacker can traverse into sibling directories and other storage namespaces, potentially accessing or modifying unauthorized data.
Affected context
This issue affects lakeFS deployments that use the local block adapter for object storage.
It is relevant when:
- Multiple repositories or logical namespaces share the same filesystem hierarchy
- Users are expected to be confined to specific storage directories or namespaces
- Object identifiers are treated as paths relative to a base directory without strong normalization and boundary checks
The risk increases in multi-tenant or multi-project environments where different users or systems are mapped to different storage roots on the same host filesystem.
Exploit preconditions
- Attack surface: lakeFS instances configured with the local block adapter (filesystem-based storage).
- Required access: Authenticated access with permission to read/write objects through the affected adapter.
- Trigger point: File operations (reads, writes, deletes, or listings) that accept object identifiers or relative paths as input.
- Why exploitation is possible:
- Path validation relied on
strings.HasPrefix()to enforce the base directory, which does not ensure directory-bound confinement and can be bypassed with similarly named sibling paths. - The adapter confirmed that resolved filesystem paths remained under a base path, but did not ensure that the logical object identifiers stayed within their intended storage namespace.
- Attackers can craft object identifiers containing path traversal segments (e.g.,
../) to step into other namespaces or sibling directories while still passing the existing validations.
Why this happens
The underlying bug is an improper path validation and canonicalization issue consistent with CWE-22: Path Traversal.
Instead of performing strict, path-aware checks on normalized filesystem paths and object identifiers, the implementation:
- Used simple string prefix matching (
strings.HasPrefix) to determine whether a requested path belonged to a given base directory. - Failed to couple filesystem path checks with enforcement that logical object identifiers remained confined to their assigned storage namespace.
This leads to a situation where relative path segments and similarly named directories can be used to escape the intended root, granting access to files outside the assigned directory or namespace.
Potential impact
- Unauthorized reading of files from sibling directories or unrelated repositories sharing the same local filesystem.
- Unauthorized modification or overwriting of files belonging to other storage namespaces.
- Cross-tenant or cross-project data exposure in multi-tenant lakeFS setups using the local adapter.
- Potential corruption of repository data or metadata stored in neighboring directories.
- Expanded blast radius for any compromised account, as it may access or alter data beyond its intended boundary.
General mitigation guidance
Mitigation centers on robust path and namespace confinement and defensive filesystem access patterns:
- Normalize and canonicalize all user-influenced paths before validation, resolving
.and..components prior to enforcing directory boundaries. - Replace simple prefix checks with checks based on path semantics (e.g., comparing absolute, cleaned paths and requiring that the requested path's root directory exactly matches the configured base directory).
- Enforce a strict mapping between logical storage namespaces (repositories, tenants, or prefixes) and their backing directories; ensure object identifiers cannot escape their namespace via traversal sequences.
- Treat object identifiers as untrusted input and validate them against a defined, restricted pattern or schema (e.g., forbidding traversal sequences, absolute paths, or invalid segments).
- Isolate tenants or repositories at the filesystem level where possible (separate roots, distinct OS users, or filesystem permissions) so that a misrouted path does not expose unrelated data.
How teams detect issues like this
Detection typically involves a combination of code-centric and runtime strategies:
- Static analysis and code review:
- Flag uses of naive prefix-based path validation (e.g.,
strings.HasPrefix(path, basePath)) for security-sensitive filesystem operations. - Identify any file operations where user-controlled input is concatenated into paths without canonicalization and boundary enforcement.
- Verify that namespace or repository identifiers are validated and cannot embed traversal segments.
- Policy and automated checks:
- Integrate custom linters or SAST rules that detect path construction from user input without calls to safe normalization utilities.
- Enforce code review checklists that require explicit path canonicalization and boundary checks for any new filesystem access logic.
- Runtime monitoring (where feasible):
- Log and monitor filesystem access patterns for unexpected references to directories outside configured storage roots.
- Alert on object identifiers or paths that include traversal indicators (e.g.,
../) or otherwise deviate from expected patterns.

