Directus: Path Traversal and Broken Access Control in File Management API
Platform
nodejs
Component
directus
Fixed in
11.17.0
## Summary Critical vulnerabilities were identified in the Directus file management API that allow unauthorized manipulation of file storage paths and metadata. These issues enable attackers to overwrite files belonging to other users, write files outside intended storage boundaries via path traversal, and potentially achieve remote code execution under certain conditions. ## Details The file management API accepts user-controlled parameters that should be restricted to server-side logic only. Specifically, the `filename_disk` parameter can be manipulated in both `POST /files` and `PATCH /files/{id}` requests, enabling two attack vectors: 1. **Path Traversal**: By specifying paths containing `../` sequences in the `filename_disk` parameter during file upload, attackers can write files outside the intended storage prefix. 2. **Broken Access Control**: By modifying the `filename_disk` parameter to reference another user's file, attackers can overwrite legitimate files with malicious content while manipulating metadata fields (such as `uploaded_by`) to obscure the tampering. ## Impact - **Unauthorized File Overwrite**: Attackers can replace legitimate files with malicious content, creating significant risk of malware propagation and data corruption. - **Storage Boundary Bypass**: Files can be written to arbitrary locations outside the designated storage area, potentially affecting system configurations or application components. - **Remote Code Execution**: If the storage backend is shared with the extensions location, attackers can deploy malicious extensions that execute arbitrary code when loaded (either via service restart or administrator-triggered extension reload). - **Data Integrity Compromise**: Sensitive files can be tampered with or replaced without visible indication in the application interface, undermining trust in stored data. ## Mitigation The `filename_disk` parameter should not be accepted from client input. File paths must be generated exclusively using server-side logic. If client input must be accepted for any path-like parameters, implementations should normalize paths and strictly verify containment within allowed directories, rejecting path traversal sequences, absolute paths, and path separator variants.
How to fix
No official patch available. Check for workarounds or monitor for updates.
Monitor your dependencies automatically
Get notified when new vulnerabilities affect your projects. Free forever.
Start free