# Secure view trivial to bypass

Secure view download restriction bypassed by extracting the WOPI access_token from the Collabora websocket URL and calling the /contents endpoint directly to download the file without watermarks.

- Payout: $150
- Severity: medium
- Program: Nextcloud
- Found by: rullzer
- Disclosed: 2023-03-30
- CVE: CVE-2023-28645
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1724021
- Library page: https://bugbountylibrary.com/r/h1%3A1724021
- Tags: area:web domain:web impact:data-leak impact:integrity kind:bounty platform:hackerone sev:medium tech:php technique:js-analysis vuln:access-control vuln:auth-bypass vuln:info-disclosure

**Target:** Nextcloud richdocuments WOPI endpoint (/apps/richdocuments/wopi/files/{id})
**Root cause:** The WOPI access_token embedded in the Collabora websocket URL grants full file access including the /contents endpoint, with no binding to Collabora or enforcement of the secure-view download restriction.
**Steps:**
1. Open a document in Collabora/richdocuments with secure view enabled and inspect the browser websocket request to `ws://127.0.0.1:9980/cool/http%3A%2F%2F.../wopi/files/149_oc13vsnxh17n%3Faccess_token%3D...%26access_token_ttl%3D.../ws`
2. Extract the URL-encoded inner WOPI URL containing `access_token` and `access_token_ttl`
3. URL-decode to get `http://127.0.0.1/index.php/apps/richdocuments/wopi/files/149_oc13vsnxh17n?access_token=...&access_token_ttl=...`
4. Append `/contents` to the path and request it with the same token to download the raw file without watermarks
**How found:** While investigating a related report (1724016), the researcher inspected the Collabora websocket request and noticed the WOPI access_token was exposed in the URL, then hypothesized the token would also authorize the /contents endpoint.
**Exploitation:** Any user with view access to a secure-view document reads the WOPI access_token from their own browser's websocket traffic, then replays it against the `/contents` endpoint to fetch the original file, defeating the download restriction.
**Insight:** Collabora/WOPI integrations leak the file access token in client-visible websocket URLs; test whether that token also authorizes sibling WOPI endpoints like /contents that bypass UI-level restrictions.

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

**WOPI contents URL bypassing secure view**

```
http://127.0.0.1/index.php/apps/richdocuments/wopi/files/149_oc13vsnxh17n/conents?access_token=r7v1y7DI6gcgvzcG85fJE0TCa0IJXvnQ&access_token_ttl=1665034074000
```

