Skip to content
Access control Disclosed report Intermediate CVE-2020-8122

Share recipient can modify a share's expiration date

The share update endpoint did not verify that the requester owned the share when changing its expiration date. A share recipient could extend the expiration date of a file shared with them, retaining access longer than intended.

netranger Follow

Originally disclosed on HackerOne

Bounty$100 Medium 4.3 View original
  • Triaged in 4 hours
  • Fixed in 49 days
  • Paid in 28 days
  • Disclosed after 14 months

Vulnerable URL

http://[server]/nextcloud/ocs/v2.php/apps/files_sharing/api/v1/shares/[share ID number]

Summary

Nextcloud users can set expiration dates on documents they share with others. However, the function to update a share does not appear to properly validate the requester is the owner when changing a share's expiration date. A user could exploit the vulnerability to extend the expiration date of a file shared with them.

The vulnerable parameter appears to be the share ID number at the end of the request URL. Sample request:

PUT /nextcloud/ocs/v2.php/apps/files_sharing/api/v1/shares/74 HTTP/1.1 OCS-APIREQUEST: true Authorization: Basic anJlYWNoZXI6d0xzVU5vVnpDZDFsNGpkdmIxZnFtOWlGUHpWbDRmWkNHTDdTMUtxRml3R3M1ZlFhc1FVUXNOV2tvY3gwcUVmbllnNmdBMVJR User-Agent: Mozilla/5.0 (Android) ownCloud-android/3.3.2 Host: 192.168.1.22 Cookie: nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; oc_sessionPassphrase=O5dbusaO3KwFs6e2P4ew7oE99UlUYbbpGa8ZwH01u6gHsvVjPiXfj362cyMkq4XNIIbYCqHESynLeG9VCWUDHHM%2B%2FHeitr910brNsOOTc5NnBy7g0JoY1uj1aY9KRQf7; oc0xkd23iidt=fc7vbute5s5efftqf2k9af9op0 Content-Length: 21 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Connection: close

expireDate=2018-11-25

Reproduction

Pre-requisites: a Nextcloud server with a couple of test users, a browser setup to go through a proxy like Burp.

  • Go to Burp, click the "Proxy" tab, click the "Intercept" subtab, and click "Intercept is On" to toggle interception off (if it's not already off)
  • Login to Nextcloud with a test user
  • Share a file with another user. Set an expiration date, for example 17-05-2019
  • Go to Burp, click the "Proxy" tab, click the "HTTP history" subtab, scroll down the list and find the call to the vulnerable URL. Note the value for the share ID (the integer at the end of the URL)
  • Logout of Nextcloud
  • Login to Nextcloud as the user you just shared the file with

At this point, we need to submit the vulnerable request as this second user. However, the vulnerable URL uses the PUT method so copy/pasting into a browser isn't really feasible. One way is to use a legitimate request as a "template" and insert the share ID of the file shared with us.

  • As the second user, open a file's sharing dialog and share it with any user
  • Go to Burp -> Proxy -> Intercept and toggle interception on
  • Go back to the browser and set an expiration date such as 17-05-2020
  • Burp should stall the request for viewing. The request should be to the vulnerable URL; if it isn't, click "Forward" until the vulnerable URL appears
  • At the end of the URL, change the share ID number to the share ID noted earlier (the share ID of the file shared with the current user by the first user)
  • Forward the request (or toggle interception off, either works)
  • Logout and log back in as the first user. Navigate to the shared file and look at the expiration date. It should be 17-05-2020, demonstrating the share recipient has extended their access to the file by a year.

Screenshots

1_request - vulnerable request as seen in Burp.

Impact

Impact/Notes

If someone shares a static file with another user, the vulnerability is less of an issue. The user granted access could download an offline copy and refer to it after share access expires.

Where this issue becomes more concerning is with "living" files that an individual might frequently edit, like a spreadsheet. A share recipient could extend their access and continue to view updated file contents until someone noticed the share instance was still in place.

This does not appear to affect groups; i.e. if a group is the recipient of a share I have not been able to successfully invoke this vulnerability as a group member.

If I can provide any further information or help with proof of concept please let me know. Thanks!

Attachments

1_request.png
1_request.png From the original on HackerOne

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

Likely the share update endpoint lacked an ownership check, allowing any authenticated user with a valid share ID to modify the expiration date.

Impact

A share recipient could extend their access to a shared file, which is more concerning for frequently updated files; the issue did not appear to affect group shares.

What the attacker needed

A Nextcloud server with at least two users; a file shared with an expiration date; attacker is the share recipient; ability to intercept and modify HTTP requests

How it was found

  1. Log in as the first user and share a file with a second user, setting an expiration date.
  2. Find the share ID from the request to the vulnerable URL.
  3. Log out and log in as the second user.
  4. As the second user, open a sharing dialog and set an expiration date to trigger a request to the vulnerable URL.
  5. Intercept the request and replace the share ID with the one from the first user's share.
  6. Forward the request, then log back in as the first user and observe the expiration date has changed.

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 you share a file, you can set an expiration date. The server should only let the file owner change that date. Here, the server let the person receiving the share change it too, so they could keep access for longer.

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 netranger

View all

6 more disclosed reports, 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.