Summary
SurrealDB direct filesystem buckets can mishandle object keys when checking permissions and converting keys into filesystem paths. An authenticated tenant with access to selected keys may use path traversal sequences to read, write, or delete other files within the storage root.
Affected context
The issue affects SurrealDB direct filesystem buckets when key-based access controls are used. It occurs when permissions are evaluated against an unnormalized object key, but that key is later converted to a filesystem path with traversal sequences collapsed without a corresponding traversal check.
Exploit preconditions
- Attack surface: Direct filesystem bucket operations
- Required access: An authenticated tenant account permitted to access some bucket keys
- Trigger point: A read, write, or delete operation using a crafted object key
- Why exploitation is possible: ACL evaluation uses the unnormalized key, while filesystem path conversion resolves traversal sequences, allowing the resulting path to refer to a different file within the storage root
Why this happens
The vulnerability is an authorization and path canonicalization mismatch. Key-based ACLs are checked before the object key is normalized, while the filesystem path conversion collapses .. sequences without verifying that the resolved path remains within the intended location. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Potential impact
- An attacker may read files within the storage root that are outside their permitted key scope.
- An attacker could modify or overwrite files within the storage root.
- An attacker may delete files that their key-based permissions should not allow them to access.
General mitigation guidance
Mitigation generally focuses on making authorization and path resolution enforce the same security boundary.
Common defensive patterns include:
- Canonicalizing and validating keys before authorization checks.
- Resolving filesystem paths and verifying they remain beneath the configured storage root.
- Rejecting traversal components and ambiguous path forms.
- Applying access controls to the canonical resource identity rather than the original key string.
- Running storage operations with only the filesystem privileges they require.
How teams detect issues like this
Detection approaches can include:
- Static analysis for filesystem path construction that lacks canonicalization or containment checks.
- Code review of the ordering between key normalization, ACL evaluation, and filesystem operations.
- Tests and security policies that verify resolved paths remain within the configured storage root.
- Monitoring for rejected or unusual object keys containing traversal-like components.

