# OAuth client trust in server metadata

Client letting the server choose its authorization server, or shipping shared secrets and tokens

_Area: Web authentication and account takeover. Seen in 3 disclosed reports; latest 2026-11-19. Updated 2026-11-20._

## How it works
OAuth separates client, authorization server (AS) and resource only if the client decides *which* AS it talks to and *which* credentials are its own. The assumption that breaks: that the AS identity and the client's credentials are fixed by the client. When a client follows a server-supplied discovery document without pinning the expected `issuer`, the server chooses where the client_secret, auth code and PKCE verifier go [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-qx49-fqc8-xw99.md). When a secret is extractable from a shipped binary and one token is shared by all installs, anyone who reads the binary holds the client's identity [E3](https://bugbountylibrary.com/r/h1%3A210779.md). And when a first-party redirect page renders the authorization code back to the user, a normal login becomes a code-theft primitive [E1](https://bugbountylibrary.com/r/blog%3Avolexity-com-blog-2025-04-22-phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows.md).

## Where it shows up
- Client fetches AS metadata/discovery from a URL supplied by the server, config or user [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-qx49-fqc8-xw99.md).
- `issuer` validated on one discovery path but not others (cached, pre-provisioned, fallback) [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-qx49-fqc8-xw99.md).
- Stored client registrations not bound to a specific issuer [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-qx49-fqc8-xw99.md).
- Redirect URIs at first-party pages that display the code (e.g. VS Code redirect, CloudDomainJoin) [E1](https://bugbountylibrary.com/r/blog%3Avolexity-com-blog-2025-04-22-phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows.md).
- Consumer key/secret extractable from desktop or mobile binaries; one bearer token shared across installs [E3](https://bugbountylibrary.com/r/h1%3A210779.md).
- Token invalidation endpoints reachable with a widely shared credential [E3](https://bugbountylibrary.com/r/h1%3A210779.md).

## How to review
State the invariant: the client must pin the expected issuer before fetching metadata, and every stored credential must be bound to that issuer, so no server-supplied document can redirect the credential flow. For redirects, confirm the code is never rendered to the user or logged. For shipped apps, confirm no consumer secret is extractable and no single token is shared across all clients. Ask: who chooses the AS, and who can read the secret?

## How finders spotted it
- Observed suspicious Signal/WhatsApp outreach to NGO staff, traced shared URLs to login.microsoftonline.com, and noticed `redirect_uri` pointed at first-party VS Code and CloudDomainJoin endpoints that surface codes to users [E1](https://bugbountylibrary.com/r/blog%3Avolexity-com-blog-2025-04-22-phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows.md).
- Noticed TweetDeck used an OAuth2 bearer token, reasoned it belonged to the TweetDeck client, and extracted the consumer key/secret from the desktop app to test invalidation [E3](https://bugbountylibrary.com/r/h1%3A210779.md).
- E2's discovery path was not documented in the evidence.

## Variants seen
- Server-advertised AS metadata trusted without issuer validation, letting the server pick the AS [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-qx49-fqc8-xw99.md).
- First-party redirect pages exposing authorization codes [E1](https://bugbountylibrary.com/r/blog%3Avolexity-com-blog-2025-04-22-phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows.md).
- Embedded consumer secret plus shared bearer token enabling global revocation [E3](https://bugbountylibrary.com/r/h1%3A210779.md).

## Impact and severity
E1 led to rogue device registration and persistent email access, escalated by chaining code theft with 2FA social engineering [E1](https://bugbountylibrary.com/r/blog%3Avolexity-com-blog-2025-04-22-phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows.md). E2 exposed client_secret, auth code and PKCE verifier to an attacker-chosen AS [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-qx49-fqc8-xw99.md). E3 broke all TweetDeck clients with code 89 errors [E3](https://bugbountylibrary.com/r/h1%3A210779.md). Severity rises with credential sensitivity and how many users share the trust.

## 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.
- **mcp (pip)** >= 2.0.0a1, < 2.2.0, fixed in 2.2.0: Model Context Protocol Python SDK: OAuth client could send credentials to an authorization server chosen by the MCP serv (CVE-2026-115563). Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-qx49-fqc8-xw99.md. Fix: https://github.com/modelcontextprotocol/python-sdk/commit/3eed7ce0a6aba76e8d94c4cfb9b266f41935392c
- **Microsoft 365** (OAuth 2.0 authorize endpoints and Entra ID Device Registrati) (version not stated): Phishing for Codes: Russian Threat Actors Target Microsoft 365 OAuth Workflows. Report: https://bugbountylibrary.com/r/blog%3Avolexity-com-blog-2025-04-22-phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows.md

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Avolexity-com-blog-2025-04-22-phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows.md
- E2: https://bugbountylibrary.com/r/ghsa%3AGHSA-qx49-fqc8-xw99.md
- E3: https://bugbountylibrary.com/r/h1%3A210779.md
