Summary
Wekan's attachment handling previously allowed authenticated board members to supply arbitrary filesystem paths and storage backends for attachment documents. Because the server streamed files directly from these paths without containment checks, attackers could read arbitrary files or cause denial of service by referencing special devices like /dev/zero.
The vulnerability becomes risky wherever board members are not fully trusted and the application runs with access to sensitive filesystem locations or system devices.
Affected context
This vulnerability arises in Wekan deployments where:
- Board members can upload or attach files via the
/attachments/insertDDP method - The server persists attacker-controlled
versions.original.pathandversions.original.storagefields - The filesystem storage strategy streams files directly from the provided path
It is most problematic when the Wekan process has access to sensitive directories (e.g., configuration, logs, backups) or special device files that can be used to consume CPU, memory, or I/O.
Exploit preconditions
- Attack surface: Application-layer API, specifically the
/attachments/insertDDP method for file attachments - Required access: Authenticated user with board write permissions (board member able to add or modify attachments)
- Trigger point: Creation of an attachment record with crafted
versions.original.pathandversions.original.storagevalues, followed by any operation that reads or streams the attachment - Why exploitation is possible: The insert rule only checks board write access and does not validate or constrain the path fields, and
FileStoreStrategyFilesystem.getReadStream()uses the stored path without enforcing a storage-root or path containment check. This combination allows both arbitrary path access and unbounded streaming from special files.
Why this happens
The core issue maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory and CWE-400: Uncontrolled Resource Consumption.
The attachment insertion logic treats user-controlled metadata as trusted, allowing absolute or traversing paths to be stored without validation. The filesystem strategy then resolves these paths directly, ignoring any root directory enforcement or normalization to a safe base. This insecure pattern lets attackers escape the intended attachment directory and target arbitrary files or device nodes. Because the streaming operation also lacks safeguards such as size limits, rate limiting, or content-type checks, reading from special files like /dev/zero can lead to resource exhaustion and denial of service.
Potential impact
- Arbitrary file reads from the server filesystem that the Wekan process can access
- Exposure of configuration files, application secrets, or system logs
- Denial of service by streaming from special device files (e.g.,
/dev/zero) causing excessive CPU, memory, or I/O usage - Increased risk of lateral movement if sensitive credentials or tokens are stored in readable files
- Degradation of service for all users due to process or host instability
General mitigation guidance
Effective mitigation centers on strictly controlling how file paths and storage backends are derived and used.
Recommended defensive patterns include:
- Treat all attachment path inputs as untrusted and derive filesystem locations server-side from validated identifiers rather than client-provided paths
- Enforce a dedicated storage root and perform path normalization plus containment checks to ensure resolved paths stay within that root
- Reject absolute paths and sequences that imply traversal (e.g.,
..) in attachment metadata - Implement resource consumption safeguards around streaming operations, such as maximum file size limits, timeouts, and rate limiting
- Run the application under least-privilege accounts with access only to the required attachment directory, avoiding permissions on sensitive system files or device nodes
How teams detect issues like this
Organizations can detect similar issues using a combination of static analysis, review practices, and runtime monitoring:
- Static analysis rules that flag use of user-controlled path fields passed into file I/O APIs without normalization or root enforcement
- Code review checklists that require verification of path containment logic and ensure attachment paths are derived from server-managed identifiers
- Security-focused tests that attempt to access files outside the intended storage directory or stream from known device paths, validating that such requests are rejected
- Runtime monitoring and logging for anomalous attachment reads, unusually large or long-running streams, or access attempts to sensitive directories and device files
- Optional use of automated security scanners or SAST tools configured to highlight CWE-22 and CWE-400 patterns in file handling components

