Summary
Teable's local attachment storage can use a client-controlled hash as a file path without ensuring that the destination stays inside the configured storage directory. A registered user may exploit this when the default local storage provider is enabled to overwrite files accessible to the backend process, potentially leading to service corruption or code execution.
Affected context
The issue occurs in Teable's local attachment storage write path, where a path derived from the hash submitted to POST /api/attachments/signature is resolved and used to save the uploaded request body without a storage-directory boundary check. The risk applies when the default local storage provider is in use; deployments using object storage that do not invoke this local write path are not affected by this specific issue. The potential impact also depends on the backend process's filesystem privileges.
Exploit preconditions
- Attack surface: The attachment signature API and local storage write path
- Required access: A registered user able to submit a request to the endpoint
- Trigger point: Saving an uploaded request body using a client-controlled hash as the storage filename
- Configuration condition: The default local storage provider must be in use
- Why exploitation is possible: The write path resolves the supplied path without verifying that the destination remains within the configured storage directory
Why this happens
The write path treats client-influenced path data as a storage filename without enforcing a containment boundary. Path resolution can therefore produce a destination outside the intended storage directory, which maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). Insufficient validation of the hash input is also relevant to CWE-20, but validation alone does not replace a path containment check.
Potential impact
- The attacker may write or overwrite files accessible to the backend process outside the intended storage directory.
- Because the described backend container runs as uid 0, an attacker could overwrite root-owned files that are writable in the environment.
- The affected instance could be corrupted or disrupted.
- File overwrites could potentially enable code execution with the backend process's privileges.
General mitigation guidance
Defensive patterns include resolving storage destinations against a trusted base directory and verifying containment before every write, as well as using server-generated storage names instead of client-controlled paths. Treat uploaded metadata as untrusted, validate it against a narrow schema, and prefer storage providers that isolate uploaded objects from application files. Run the backend with least privilege so that a storage-path mistake cannot write to sensitive system locations.
How teams detect issues like this
- Use static analysis to identify file-write operations whose paths depend on request data and lack canonical-path containment checks.
- Review all read and write paths separately; protections on a read path do not establish safety for writes.
- Add tests and code-review checks for traversal-like input, canonicalized paths outside the storage root, and alternate storage-provider configurations.
- Enforce policies that restrict writable locations and prevent application containers from running with unnecessary elevated privileges.
- Automated code review tools may help flag untrusted path construction and file-copy destinations.

