Summary
Cozy Stack's shared-drive move handler has an authorization flaw that may let an authenticated user access files belonging to another instance. The risk arises when a user who owns a shared drive can supply another instance's domain and a directory ID as the move source, potentially copying and deleting the victim's file tree.
Affected context
The issue is in the shared-drive move handler in Cozy Cloud cozy-stack versions before 1.6.69. It may be present when the handler processes a move source identified by a user-supplied domain and directory ID without adequately verifying that the requesting user is authorized to access that instance's files.
Exploit preconditions
- Attack surface: The shared-drive move operation
- Required access: An authenticated account that owns a shared drive
- Trigger point: Processing a move request with a source naming another instance's domain and a directory ID
- Why exploitation is possible: The handler may not sufficiently bind the supplied source identifiers to the user's authorized instance and file scope
Why this happens
The move handler appears to rely on user-controlled identifiers to select files without enforcing authorization against the relevant instance and directory. This maps to CWE-639: Authorization Bypass Through User-Controlled Key, in which an attacker changes a key used to identify a resource and gains access because authorization checks do not adequately constrain that lookup.
Potential impact
- An attacker may access files belonging to another instance
- Files or directory trees could be copied without authorization
- A victim's file tree could be deleted as part of the move operation
- The incident could cause data exposure, data loss, or operational disruption
General mitigation guidance
Mitigations generally focus on enforcing authorization at the point where resources are resolved and acted upon.
- Derive tenant and instance scope from trusted authenticated context rather than accepting it solely from request parameters
- Verify ownership and permissions for every source and destination resource before performing a move
- Use secure-by-default resource lookups that restrict results to the caller's authorized scope
- Apply least privilege to services and accounts that perform file operations
- Treat client-provided identifiers as untrusted and avoid relying on obscurity or identifier unpredictability as an access control
How teams detect issues like this
- Review move-handler code for resource lookups driven by caller-supplied domains or directory IDs
- Use static analysis or code review checks to flag resource access that lacks nearby authorization and tenant-scope validation
- Test authorization policies with cross-instance resource references, including both copy and delete behavior
- Monitor for move operations involving resources outside the authenticated user's instance or permitted scope
- Enforce policy checks at service boundaries so cross-tenant file operations are denied by default

