# Download permissions can be changed by resharer

A resharer could re-enable download permission on a share they received without download rights, defeating Nextcloud's secure-view watermarking for downstream recipients.

- Payout: $500
- Severity: medium
- Program: Nextcloud
- Found by: rullzer
- Disclosed: 2023-02-24
- CVE: CVE-2023-25821
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/1724016
- Library page: https://bugbountylibrary.com/r/h1%3A1724016
- Tags: area:web domain:web impact:integrity kind:bounty platform:hackerone sev:medium tech:rest technique:source-review vuln:access-control vuln:business-logic

**Target:** Nextcloud files_sharing OCS API share update endpoint (PUT /ocs/v2.php/apps/files_sharing/api/v1/shares/{id})
**Root cause:** The share-update endpoint did not validate that the resharer actually held the download permission/attribute before allowing them to set the download attribute on a share they created.
**Steps:**
1. user1 shares folder to user2 with reshare permission but download disabled (share ID 10).
2. user2 reshares folder to user3 (share ID 11).
3. user2 sends `PUT /ocs/v2.php/apps/files_sharing/api/v1/shares/11` with `OCS-APIREQUEST: true` and body `{"permissions":"17","attributes":"[{\"scope\":\"permissions\",\"key\":\"download\",\"enabled\":true}]"}`.
4. user3 can now download files, bypassing secure view.
**How found:** Researcher reasoned that the new NC25 download-limit feature must be enforced on the reshare path, then tested whether the resharer could mutate the download attribute via the share update API.
**Exploitation:** Any user holding a reshare-permitted share without download rights can call the OCS share update API on their own downstream share and set the download attribute to enabled, granting download to recipients.
**Insight:** When a permission is enforced via an 'attribute' rather than the permission bitmask, test whether a downstream share owner can flip that attribute on their own share via the update API — the server may only check the bitmask, not the inherited attribute.

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

**PUT request re-enabling download on reshare**

```
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}]"}'
```

