HexBrain

Nextcloud · Report #1724016

Download permissions can be changed by resharer

Validstatus
mediumseverity
$500bounty
49upvotes
24 Feb 2023disclosed

Summary

Security advisory at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-7w6h-5qgw-4j94

How it was found

The new feature in NC 25 to limit downloads also for internal shares is meant to force users to use secure view. So documents are watermarked and what not.

Assume a company wide share. People can share files from it to others but they can't be downloaded. For simplicity

  • user1 shares a folder with reshare permissions but without download permissions to user2. Assume this is a share with ID 10
  • user2 shares that folder with user3, this is a share with ID 11

This all works as expected

Now user2 simply does a PUT

curl -u user2:pass 'https://SERVER/ocs/v2.php/apps/files_sharing/api/v1/shares/11' -X PUT -H "OCS-APIREQUEST: true" -H 'Content-Type: application/json' --data-raw '{"permissions":"17","attributes":"[{\"scope\":\"permissions\",\"key\":\"download\",\"enabled\":true}]"}'

And there you go. No more pesky secure view. Just easy downloads for user3.

Impact

Secure view for internal shares is useless if also reshare permissions are given.

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original