Any (non-admin) user from an instance can destroy any (user and/or global) external filesystem
The external storage deletion endpoint did not verify that the requesting user owned the storage or that it was a user-type mount. Any authenticated user could delete any user or global external storage by sending a DELETE request with its numeric ID.
- Triaged in 15 hours
- Fixed in 32 days
- Disclosed after 39 days
Summary by the program
Security advisory at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-xwxx-2752-w3xm
The report
Summary:
There is no verification of the ownership and/or its type when deleting a user-manager external storage. Meaning anyone on a Nextcloud instance can destroy any (user, global) external filesystem. The attacker does not need to have access to the external storage. The options 'Allow users to mount external storage does not need to be enabled.
When executing the DELETE request on /apps/files_external/userstorages/<storage_id> [1], the app will:
- only check that the mount exists in database, without any condition based on the type of the storage and/or its owner [2]
- remove all data from database related to the storage based on its id. [3]
[1] https://github.com/nextcloud/server/blob/master/apps/files_external/lib/Controller/UserStoragesController.php#L234 [2] https://github.com/nextcloud/server/blob/master/apps/files_external/lib/Service/DBConfigService.php#L67 [3] https://github.com/nextcloud/server/blob/master/apps/files_external/lib/Service/DBConfigService.php#L274
Steps To Reproduce:
- From an admin session, create a new external storage.
- From a non-admin session, send a DELETE request to
/apps/files_external/userstorages/<storage_id>, replacestorage_idby the correct id (integer) of the storage. - From an admin session, the created external storage is not listed anymore.
Impact
Filesystem can be unmounted by anyone, I have no clue how this was not reported earlier.
Attachments
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The delete handler looked up the storage by ID and removed its database records without checking the caller's ownership or the storage type.
Impact
Any authenticated user could unmount and remove the configuration of any user or global external storage, disrupting access to those files; the attacker did not need access to the storage itself.
What the attacker needed
A non-admin account on the instance; knowledge of the target storage's numeric ID
How it was found
- As an admin, create a new external storage.
- As a non-admin user, send a DELETE request to the userstorages endpoint using the storage's numeric ID.
- As the admin, observe that the external storage is no longer listed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
External storage lets a Nextcloud instance connect to files stored elsewhere, like a network drive. The app that manages these connections had a delete action that only checked the storage existed, not who was allowed to remove it. So any logged-in user could make someone else's external storage disappear from the system.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.