Summary
SeaweedFS versions 3.88 through 4.39 contain an authorization flaw in the SFTP server's configured path-permission checks. An authenticated, low-privilege user with narrowly scoped access may reach sibling paths whose names merely share the permitted path's prefix, potentially reading or modifying another tenant's files when the account has write access.
Affected context
The issue occurs in SeaweedFS deployments that expose the SFTP service and use path-based permissions to restrict authenticated users. It becomes risky when a user's permitted path is a textual prefix of another path, such as /tenants/alice and /tenants/alice-archive, and the authorization logic does not enforce a path-component boundary.
Exploit preconditions
- Attack surface: The SeaweedFS SFTP service
- Required access: Valid credentials for an authenticated SFTP user with a restricted path scope
- Trigger point: Authorization checks performed while resolving or accessing SFTP paths
- Why exploitation is possible: The permission check compares literal string prefixes without confirming that the prefix ends at a complete path component
- Potentially required privilege: Read access is sufficient for unauthorized disclosure; write access may enable unauthorized modification
Why this happens
The vulnerability results from implementing path authorization as a simple literal string-prefix comparison. This treats a permitted path such as /tenants/alice as equivalent to a complete directory boundary, even though it also matches sibling names such as /tenants/alice2.
The insecure pattern fails to normalize and compare path components or otherwise enforce a boundary-aware relationship between the configured scope and the requested path. This maps to CWE-863: Incorrect Authorization, because the system may grant access beyond the privileges assigned to the authenticated user.
Potential impact
- An attacker may read files belonging to another tenant
- An attacker with write permissions could overwrite or alter another tenant's files
- Sensitive data could be disclosed across configured tenant boundaries
- Stored content could be corrupted or replaced
- Downstream applications may consume unauthorized or tampered data
General mitigation guidance
Mitigation generally focuses on making authorization decisions based on canonical, component-aware paths rather than raw string prefixes.
Common defensive patterns include:
- Require an exact path match or a valid path-component boundary when evaluating scoped permissions
- Canonicalize paths consistently before authorization and file access
- Reject ambiguous, alternate, or non-canonical path representations
- Apply least-privilege read and write permissions independently
- Use isolated storage roots or tenant-specific namespaces where practical
- Treat authenticated SFTP identities as untrusted outside their explicitly assigned scope
- Add regression tests covering similarly prefixed sibling directories
How teams detect issues like this
Organizations can look for this issue through:
- Static analysis and code review rules that flag raw string-prefix checks in authorization logic
- Tests using permitted paths alongside similarly prefixed sibling paths
- Review of path canonicalization and component-boundary handling
- Integration tests verifying that read and write operations remain within each user's assigned root
- Policy checks requiring authorization decisions to occur after safe path normalization
- Audit-log monitoring for access attempts involving paths outside a user's configured scope

