# Share token policy not enforced

Share, invite or preview tokens accepted without revocation, consent, ownership or role checks

_Area: Web access control and IDOR. Seen in 4 disclosed reports; 3 confirmed bounties, median $3,134, range $900-$4,000; latest 2022-04-22. Updated 2026-12-05._

## How it works
A token or encoded parameter is meant to prove one narrow thing: this link was shared, this invite was sent, this preview was rendered. The code instead treats it as proof of everything — that the sender is the real owner, that the recipient consented, that the token is still valid, or that the caller may act for the account named inside it. The broken assumption is that possession of a share/invite/preview token implies authorization for the action being requested. When the token is guessable, leaked to the wrong party, never revoked, or carries a trusted field the server never re-checks, anyone holding it can act as owner or victim.

## Where it shows up
- Federation/OCM notification or callback endpoints that accept a `sharedSecret`/token as bearer auth without authenticating the sender [E1](https://bugbountylibrary.com/r/h1%3A1170024.md)
- Permission-change or reshare messages processed without verifying they originate from the legitimate share owner [E1](https://bugbountylibrary.com/r/h1%3A1170024.md)
- Base64-looking request params with odd padding (trailing `.` instead of `=`) that embed a recipient email or account id [E2](https://bugbountylibrary.com/r/blog%3Aavatao-com-blog-how-i-could-have-stolen-your-photos-from-google-my-first-3-bug-bounty-writeups.md)
- Preview/screenshot URLs on a CDN or secondary host that are not invalidated on password change or user removal [E3](https://bugbountylibrary.com/r/h1%3A1489077.md)
- List/manage endpoints that return an invite acceptance key or link to the inviter rather than the invitee [E4](https://bugbountylibrary.com/r/h1%3A1040047.md)
- Tokens stored in local tables (e.g. `oc_share_external`) that are harvested from your own instance and replayed against the endpoint [E1](https://bugbountylibrary.com/r/h1%3A1170024.md)

## How to review
For each token, ask: what is the exact property it proves, and does the handler re-check everything else? The invariant: a share/invite/preview token authorizes only the specific action and principal it was issued for, and is invalidated on revocation, password change, or user removal. Check that the sender of a permission-change is authenticated as the share owner, not merely holding a secret [E1](https://bugbountylibrary.com/r/h1%3A1170024.md); that embedded recipient fields are not trusted without a server-side check that the victim intended to share with that account [E2](https://bugbountylibrary.com/r/blog%3Aavatao-com-blog-how-i-could-have-stolen-your-photos-from-google-my-first-3-bug-bounty-writeups.md); that every place a preview token appears (admin UI and CDN image URLs) shares one revocation path [E3](https://bugbountylibrary.com/r/h1%3A1489077.md); and that acceptance keys are never returned to the inviter [E4](https://bugbountylibrary.com/r/h1%3A1040047.md).

## How finders spotted it
- Added a public link as a federated share, then inspected the local `oc_share_external` table for remote id and token, hypothesizing the OCM endpoint trusted them without sender auth [E1](https://bugbountylibrary.com/r/h1%3A1170024.md)
- Reviewed the DevTools network tab, noticed a base64-looking `request` param ending in `.` instead of `=`, decoded it and hypothesized the embedded email could be swapped [E2](https://bugbountylibrary.com/r/blog%3Aavatao-com-blog-how-i-could-have-stolen-your-photos-from-google-my-first-3-bug-bounty-writeups.md)
- Knew a prior fix expired the admin-UI preview URL, so read the raw HTML of the themes page and found a second preview hostname in CDN screenshot URLs, then tested it against password-change invalidation [E3](https://bugbountylibrary.com/r/h1%3A1489077.md)
- Noticed the invite acceptance link/key was visible to the inviter in the management UI and API response [E4](https://bugbountylibrary.com/r/h1%3A1040047.md)

## Variants seen
- Forged permission-change notification granting write/share on any federated share [E1](https://bugbountylibrary.com/r/h1%3A1170024.md)
- Crafted partner-sharing link silently sharing victim photos [E2](https://bugbountylibrary.com/r/blog%3Aavatao-com-blog-how-i-could-have-stolen-your-photos-from-google-my-first-3-bug-bounty-writeups.md)
- Static CDN preview token surviving revocation [E3](https://bugbountylibrary.com/r/h1%3A1489077.md)
- Invite key leaked to inviter enabling signup for unregistered email [E4](https://bugbountylibrary.com/r/h1%3A1040047.md)

## Why fixes fail
E3 shows a fix that expired only the admin-UI preview URL while a second CDN screenshot token stayed static, so the bypass survived password change and user removal [E3](https://bugbountylibrary.com/r/h1%3A1489077.md).

## Impact and severity
Write access to any federated share or public link, escalating any recipient to write/share [E1](https://bugbountylibrary.com/r/h1%3A1170024.md); silent photo sharing [E2](https://bugbountylibrary.com/r/blog%3Aavatao-com-blog-how-i-could-have-stolen-your-photos-from-google-my-first-3-bug-bounty-writeups.md); permanent access to a password-protected store after revocation [E3](https://bugbountylibrary.com/r/h1%3A1489077.md); email-verification bypass on signup [E4](https://bugbountylibrary.com/r/h1%3A1040047.md). Severity rises with reach (any share, not just public links [E1](https://bugbountylibrary.com/r/h1%3A1170024.md)) and with tokens that never expire [E3](https://bugbountylibrary.com/r/h1%3A1489077.md).

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **Nextcloud**: Attacker can obtain write access to any federated share/public link (CVE-2021-32654). Report: https://bugbountylibrary.com/r/h1%3A1170024.md

## Evidence
- E1: https://bugbountylibrary.com/r/h1%3A1170024.md
- E2: https://bugbountylibrary.com/r/blog%3Aavatao-com-blog-how-i-could-have-stolen-your-photos-from-google-my-first-3-bug-bounty-writeups.md
- E3: https://bugbountylibrary.com/r/h1%3A1489077.md
- E4: https://bugbountylibrary.com/r/h1%3A1040047.md
