# JWTKit: Missing aud validation in Apple/Google/Microsoft identity tokens can enable cross-client authentication bypass

JWTKit's Apple/Google/Microsoft identity token verifiers check issuer and expiry but never the aud claim, so a token issued for an attacker's OAuth client is accepted as a valid login by other apps.

- Payout: Research
- Severity: high
- Program: JWTKit
- Found by: Nadav0077
- Disclosed: 2026-12-02
- CVE: CVE-2026-142551
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-gxx9-vxm7-hgrq
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-gxx9-vxm7-hgrq
- Tags: area:oss domain:oss impact:ato kind:research platform:ghsa sev:high tech:jwt tech:oauth tech:oidc technique:chained technique:source-review vuln:access-control vuln:auth-bypass

**Target:** Swift JWT library vendor ID token verification (AppleIdentityToken, GoogleIdentityToken, MicrosoftIdentityToken)
**Root cause:** The vendor payload types' verify(using:) implementations validate iss/exp (and tid consistency) but never compare the aud claim to the relying party's client ID, unlike the Firebase implementation which binds audience to issuer.
**Steps:**
1. Add an HMAC key to a JWTKeyCollection and sign an AppleIdentityToken with `issuer: "https://appleid.apple.com"`, `audience: "com.attacker.app"`, future expiry, and a victim subject.
2. Call `keys.verify(appleJWT, as: AppleIdentityToken.self)`; it succeeds despite the attacker audience.
3. Control: sign a token with `issuer: "https://attacker.example"` and verify; it is rejected, proving claim verification runs but aud is unchecked.
4. Repeat with GoogleIdentityToken (`audience: "attacker-client.apps.googleusercontent.com"`) and MicrosoftIdentityToken (attacker Application ID with matching tenant issuer); both are accepted.
**How found:** Code review of JWTSigner.verify() flow into payload.verify(using:), noticing vendor verifiers check iss/exp but not aud, and comparing against FirebaseAuthIdentityToken which derives project ID from audience and enforces issuer consistency.
**Exploitation:** Attacker registers their own OAuth/OIDC client with Apple/Google/Microsoft, obtains a genuine provider-signed ID token whose aud is the attacker client, and submits it to a victim application that uses JWTKit's vendor token type as its login check. Signature, issuer and expiry all pass, so the victim app treats the attacker's token as a verified identity; account impact depends on the app's identity mapping/account-linking.
**Escalation:** Cross-client token reuse becomes authentication bypass or account takeover where the victim app maps provider subject/email to existing accounts without its own audience check.
**Insight:** When a library ships per-provider token types, diff their verify() implementations against each other: the one provider that binds aud to iss (Firebase here) reveals what the others are missing. Also check whether documented-as-security-relevant claims are actually enforced in code.

