Description
Cockpit CMS contains a path traversal vulnerability in the Bucket file storage API (/system/buckets/api). The api() method in modules/System/Controller/Buckets.php sanitizes the bucket name with preg_replace('/[^a-zA-Z0-9-_\\.]/','', $bucket), which permits '..' and '../' sequences. The sanitized value is interpolated into a Flysystem path as uploads://buckets/{bucket}. Flysystem's WhitespacePathNormalizer resolves 'buckets/..' to the empty string (the uploads storage root) without raising PathTraversalDetected because the '..' has a preceding component to consume. An authenticated low-privileged user can send a crafted request with a '../' bucket name to list, upload, and delete files across all buckets, including those belonging to other users or roles
Problem types
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Product status
Any version before 2.14.0
Credits
Saidakbarxon Maxsudxonov
References
github.com/cockpit-hq/cockpit (Product)
github.com/...ommit/dde2d1d74f5f4e11de42a298918ea8c9684f932c (Patch Commit)
gist.github.com/sermikr0/821c4edd3c34e98a62a50b07707785bd
www.vulncheck.com/...uthorization-in-bucket-file-storage-api
www.vulncheck.com/...-bucket-name-in-bucket-file-storage-api