# Pocket ID: The client credentials grant allows any OIDC client to obtain tokens for arbitrary audiences

Pocket ID's client credentials grant copies the unvalidated resource parameter into the JWT aud claim, letting any OIDC client mint tokens for arbitrary audiences.

- Payout: Research
- Severity: high
- Program: Pocket ID
- Found by: duijf
- Disclosed: 2026-11-09
- CVE: CVE-2026-62662
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-q4xm-p75h-h9p3
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-q4xm-p75h-h9p3
- Tags: area:web domain:api domain:web impact:internal-access impact:privesc kind:research platform:ghsa sev:high tech:jwt tech:oidc technique:source-review vuln:access-control vuln:auth-bypass

**Target:** OIDC token endpoint (/api/oidc/token) client credentials grant
**Root cause:** createTokenFromClientCredentials assigns input.Resource directly to the aud claim without checking it is a registered resource server or that the client is authorized for it; only client credential validity is verified.
**Steps:**
1. Register/obtain credentials for attacker client `client-a` and note target audience `client-b`.
2. POST to `/api/oidc/token` with `grant_type=client_credentials`, `client_id=client-a`, `client_secret=<client-a-secret>`, `resource=client-b`.
3. Receive a Pocket ID-signed JWT with `sub: client-client-a` and `aud: ["client-b"]`.
4. Present the token to a resource server trusting Pocket ID JWKS and accepting `client-b` as audience; signature and aud checks pass.
**How found:** Code review of oidc_service.go: noticed audClaim is overwritten by input.Resource with no validation, and that introspection has no server-side record of the requesting client.
**Exploitation:** A malicious or compromised OIDC client authenticates with its own valid secret, requests a token with resource set to another client's ID, and uses the resulting signed JWT to pass audience-based authorization at that resource server. Introspection does not help because it only compares the introspecting client ID to the attacker-controlled aud claim.
**Escalation:** Any registered client can target any other registered client or arbitrary audience string, breaking service-to-service isolation across the whole deployment.
**Insight:** In OIDC deployments, audit whether the resource/audience parameter is validated against a registry and per-client authorization; introspection endpoints that only compare client ID to the token's own aud claim cannot detect forged audiences.

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

**curl request forging arbitrary audience token**

```
curl -X POST https://<pocket-id-host>/api/oidc/token \
    -d "grant_type=client_credentials" \
    -d "client_id=client-a" \
    -d "client_secret=<client-a-secret>" \
    -d "resource=client-b"
```

