# Daptin: Broken Access Control (IDOR) in the generic YJS collaboration endpoint

Daptin's generic /yjs/:documentName WebSocket route skipped per-row permission checks, letting any authenticated user read or write any file.* column on any table.

- Payout: Research
- Severity: critical
- Program: Daptin
- Found by: tinyb0y
- Disclosed: 2026-11-20
- CVE: CVE-2026-77369
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-wj7x-58c2-5793
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-wj7x-58c2-5793
- Tags: area:web domain:web impact:data-leak impact:integrity kind:research platform:ghsa sev:critical tech:go tech:websocket technique:source-review vuln:access-control vuln:auth-bypass vuln:idor

**Target:** WebSocket YJS collaboration endpoint GET /yjs/:documentName
**Root cause:** The generic /yjs/:documentName route only checks that a session exists, then passes the user-controlled documentName (typename.referenceId.columnName) to the YJS content provider, which fetches the row's column content without any GetRowPermission/CanUpdate check.
**Steps:**
1. Authenticate as a low-privilege self-registered user (bob@bob.com) and obtain a bearer token.
2. Send a WebSocket upgrade request to `GET /yjs/calendar.deadbeef-0000-0000-0000-000000000000.content` with `Authorization: Bearer $BOB_TOKEN`; server responds `101 Switching Protocols` with no permission check.
3. Compare against the secured sibling `GET /live/calendar/deadbeef-0000-0000-0000-000000000000/content/yjs`, which returns `404` after performing the row lookup.
4. Confirm the generic route still requires a session: same request without the token returns `403 Forbidden`.
5. Supply a real `typename.referenceId.columnName` triple (reference IDs leak in list/read API responses) to receive that column's actual base64-decoded content via initial YJS sync.
**How found:** Compared the two routes registered in InitializeYjsResources: the purpose-built /live/... route loads the row and calls objectPermission.CanUpdate, while the generic /yjs/:documentName route only checks sessionUser != nil. Traced documentName into the YJS initial content provider and saw it split on '.' into typename/referenceId/columnName and fetch the row unconditionally.
**Exploitation:** Any authenticated user, including a zero-privilege self-registered account, connects to /yjs/<table>.<referenceId>.<file.* column> and the initial YJS sync serves the real column content, bypassing row/column permissions. Because YJS sync is bidirectional, the same connection can push edits that legitimate collaborators later pull through the secured /live/... route, corrupting shared documents.
**Escalation:** Read access to admin-only tables (e.g. calendar) and any file.* column; write path enables integrity corruption of documents other users later open.
**Insight:** When a codebase registers both a hardened per-resource route and a generic catch-all route for the same handler, diff their pre-handler checks: the generic route often inherits only the session gate. Also check whether the downstream content provider re-parses the identifier and re-fetches without authorization, since the route's checks are the only gate.

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

**curl to generic /yjs endpoint accepted for admin-only table**

```
curl -i -N \
  -H "Authorization: Bearer $BOB_TOKEN" \
  -H "Connection: Upgrade" -H "Upgrade: websocket" \
  -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
  "http://localhost:6336/yjs/calendar.deadbeef-0000-0000-0000-000000000000.content"
```

**Secured sibling /live route correctly rejects same identifier**

```
curl -i -N \
  -H "Authorization: Bearer $BOB_TOKEN" \
  -H "Connection: Upgrade" -H "Upgrade: websocket" \
  -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
  "http://localhost:6336/live/calendar/deadbeef-0000-0000-0000-000000000000/content/yjs"
```

