User with read-only access to a share can gain write access to sub-folders in the share
A user with read-only access to a shared folder could create a link share of a sub-folder and then use the sharing API to increase the link's permissions to allow writing. This let them modify or delete files in the sub-folder, even though the original share was read-only.
Originally disclosed on HackerOne
- Triaged in 2 days
- Fixed in 7 days
- Paid in 7 days
- Disclosed after 8 months
user0 creates folders /test and /test/sub user0 creates file /test/sub/file.txt user0 shares folder /test with user1 with read+share permissions (17) user1 receives the folder /test and can read-download /test/sub/file.txt - good user1 creates a link share of /test/sub - it has permissions 1 (read-only) - good user1 uses the sharing API to escalate the permissions of the link share, e.g.
curl --user user1:user1 "http://172.17.0.1:8081/ocs/v1.php/apps/files_sharing/api/v1/shares/3" -H "OCS-APIRequest: true" -X PUT --data 'permissions=15'
Now browse to the link, e.g. my link was http://172.17.0.1:8081/index.php/s/t9dfm6K57yo6a9r
From the link, anyone (in this case user1, who has knowledge of the link) can create/change/delete files. e.g. delete file.txt and then upload other files, or some different file.txt
Now login as user0.
user0 sees that the content of /test/sub has been changed. But they only gave read and share permissions to user1. They never gave any create-change-delete permissions to anyone.
Impact
A user who has shared some folder(s) read-only can have the content of sub-folders modified by a user who has received the read-only share.
Here is a realistic use case where this public link share permissions bump will be a real issue:
- the organisation shares read-only a folder to almost everybody. In that folder are sub-folders that have files that have, for example, organisation policy documents (
Policy/FinancePolicy/HRetc folders) - just 1 user
bob's password/authentication details are compromised, orbobis malicious himself - the attacker
bobmakes a read-only public link share of each sub-folder - the attacker
bobincreases the permissions of the public link share to read-write-delete - the attacker
bobbrowses to the public link share, deletes all the real policy documents and uploads different ones...
Now everybody else in the organisation sees different documents in the (supposedly) read-only share.
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
Impact
A user with only read access to a shared folder could modify or delete files in its sub-folders, potentially affecting other users who rely on the shared content.
What the attacker needed
Attacker has a read-only share of a folder; attacker can create a link share of a sub-folder; attacker can access the sharing API
How it was found
- user0 creates folders /test and /test/sub and a file /test/sub/file.txt
- user0 shares /test with user1 with read+share permissions
- user1 creates a link share of /test/sub (read-only)
- user1 uses the sharing API to change the link share permissions to allow write
- user1 browses to the link and can create, change, or delete files
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.
When someone shares a folder with you as read-only, you shouldn't be able to change anything inside it. But here, the user could create a public link to a sub-folder and then change that link's settings to allow editing. That meant they could delete or replace files, even though they only had read access.
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.