Skip to content
Access control Disclosed report Intermediate CVE-2019-15621

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.

phil-davis Follow

Originally disclosed on HackerOne

Medium 4.8 View original
  • 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:

  1. 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/Finance Policy/HR etc folders)
  2. just 1 user bob's password/authentication details are compromised, or bob is malicious himself
  3. the attacker bob makes a read-only public link share of each sub-folder
  4. the attacker bob increases the permissions of the public link share to read-write-delete
  5. the attacker bob browses 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.

The original report as published on HackerOne, by phil-davis. 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

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

  1. user0 creates folders /test and /test/sub and a file /test/sub/file.txt
  2. user0 shares /test with user1 with read+share permissions
  3. user1 creates a link share of /test/sub (read-only)
  4. user1 uses the sharing API to change the link share permissions to allow write
  5. 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.

More by phil-davis

View all

1 more disclosed report, best first.

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.