Skip to content
Access control Disclosed report Beginner CVE-2023-39962

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.

cult Follow

Originally disclosed on HackerOne

Medium 6.5 View original
  • 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>, replace storage_id by 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

recording-1688310781410.webm From the original on HackerOne

The original report as published on HackerOne, by cult. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. As an admin, create a new external storage.
  2. As a non-admin user, send a DELETE request to the userstorages endpoint using the storage's numeric ID.
  3. 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.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.