# OpenID Connect Security > OIDC flaws happen when a relying party trusts an identity assertion it hasn't fully validated. Typical cases are an ID token for the wrong audience, an unverified signature, a mutable claim such as `email` used as the account key, or an OIDC trust policy loose enough to admit other tenants. ## How it works OIDC adds an authentication layer to OAuth 2.0. The authorization server returns an **ID token**: a signed JWT with `iss`, `sub`, `aud`, `exp` and `nonce` that says who logged in ([[raw/developer.okta.com/an-illustrated-guide-to-oauth-and-openid-connect-6993|Okta]]). Everything on [[OAuth 2.0 Vulnerabilities]] still applies. The OIDC-specific surface is what the relying party (RP) does with the identity: - **Token validation**: the RP must check signature (against the provider's JWKS), `iss`, `aud` and `exp` ([[raw/cheatsheetseries.owasp.org/owasp-authentication-cheat-sheet-3897|OWASP]]). A token can be correctly signed and unexpired and still not be meant for your service. Audience and issuer are what scope it ([[raw/medium.com/a-token-can-be-valid-and-still-not-be-meant-for-your-api-15115|audience note]]). Skipped signature or nonce checks in libraries have led to full impersonation (CVE-2020-26244, CVE-2024-10318) ([[raw/guptadeepak.com/sso-protocol-security-critical-vulnerabilities-in-saml-oauth-oidc-jwt-4718|survey]]). - **Identity keying**: `sub` has no standard format, so apps fall back to `email` or handles. Some providers don't guarantee those are immutable or verified. That gives "mutable claims" ATO ([[raw/blog.doyensec.com/doyensec-common-oauth-vulnerabilities-3891|Doyensec]]). Even Google documents that email shouldn't be the identifier. Its `hd` (hosted domain) claim is just a domain, not a unique ID, so a re-registered domain inherits old logins ([[raw/trufflesecurity.com/google-oauth-is-broken-sort-of-7002|Truffle Security]]). - **Account linking and JIT provisioning**: auto-linking or auto-creating accounts from claims lets any IdP that can assert a matching email take the account. OWASP says to key on `iss`+`sub`, never auto-link on `email`/`preferred_username`, require an authenticated and re-authenticated session to add a link, validate the new ID token, and notify the user ([[raw/cheatsheetseries.owasp.org/owasp-authentication-cheat-sheet-3897|OWASP]]). - **Multi-IdP tenancy**: when tenants bring their own IdP into one user pool, a malicious tenant IdP can mint identities in other tenants' namespaces. Doyensec's Cognito examples include JIT "ghost identity" injection, trigger-source misinterpretation and `sub`-splitting ([[raw/blog.doyensec.com/the-danger-of-multi-sso-aws-cognito-user-pools-11460|Doyensec]]). - **Workload identity (machine OIDC)**: CI systems and SaaS vendors present OIDC tokens to cloud IAM. The trust policy's conditions *are* the authorization. Without a `sub` condition, any GitHub user's workflow could assume the role ([[raw/wiz.io/avoiding-mistakes-with-aws-oidc-integration-conditions-9491|Wiz]], [[raw/docs.github.com/oidc-security-hardening-for-github-actions-4060|GitHub docs]]). - **Discovery and registration**: discovery documents and dynamic client registration turn `jwks_uri`, `request_uris` and `logo_uri` into server-side fetches (SSRF) ([[raw/portswigger.net/portswigger-hidden-oauth-attack-vectors-4082|PortSwigger Research]]). ## What to check - [ ] Which claim keys the local account? (`iss`+`sub` is correct. `email`, `upn`, `preferred_username` or `sub` alone across several IdPs is a finding.) - [ ] Is `email_verified` honored, and parsed as a strict boolean (not the truthy string `"false"`)? Can you create an IdP account with someone else's email or alias and log in? - [ ] Pre-account hijacking: can a local account be registered or edited to an unverified victim email, so the victim's first SSO login links into it? - [ ] ID-token validation: forge or strip the signature, change `aud`/`iss`, replay without `nonce`, use an expired token. Does the RP still accept it? - [ ] Do tokens issued for a different client or API work against this one (audience confusion)? - [ ] Account linking: is re-authentication required? Is the link callback bound to the session? Is the user notified? Is access through a removed identity actually cut off? - [ ] Multi-tenant SSO: can a tenant-controlled IdP assert identities with another tenant's domain? Are provisioning hooks applied on every path (first sign-in and later sign-ins)? - [ ] Cloud OIDC trust policies: are both `aud` and an exact `sub` (repo/branch/environment) conditioned? Look for wildcards and vendor-specific required conditions. - [ ] Callback endpoints: do they accept cross-site form posts without CSRF or Origin checks (login CSRF)? - [ ] Discovery and registration endpoints: is registration open? Which URLs does the server fetch? ## Notable cases - **Google OAuth "former employee" access**: non-Gmail Google accounts created on corporate addresses or aliases kept access to Slack, Zoom and similar after offboarding. Google paid $1,337, and the issue was publicly disclosed after 134 days unfixed ([[raw/trufflesecurity.com/google-oauth-is-broken-sort-of-7002|Truffle Security]]). - **AWS OIDC trust conditions**: GitHub Actions roles without a `sub` condition were assumable from any repo. Similar required conditions exist across 20+ vendors (Terraform Cloud, GitLab, Defender) ([[raw/wiz.io/avoiding-mistakes-with-aws-oidc-integration-conditions-9491|Wiz]]). - **AWS Cognito multi-SSO**: a malicious tenant OIDC IdP landed users in the pool past the domain check because only some triggers enforced it ([[raw/blog.doyensec.com/the-danger-of-multi-sso-aws-cognito-user-pools-11460|Doyensec]]). - **miniOrange OAuth SSO for WordPress ≤6.26.12 (CVE-2025-9485)**: ID-token signatures were never verified, so a forged `sub` gave admin ([[raw/zeropath.com/oauth-sso-wordpress-plugin-jwt-bypass-cve-2025-9485-4721|ZeroPath]]). - **Keycloak Organizations (CVE-2026-1529, CVSS 8.1)**: invitation JWTs were accepted without signature verification, so editing the org ID gave access to restricted orgs ([[raw/cvereports.com/cve-2026-1529-bypassing-keycloak-org-security-4954|writeup]]). - **Authlib (GHSA-fch4-3c6x-j4gc)**: an empty `get_audiences()` made the RFC 7523 bearer grant accept assertions meant for other audiences ([[raw/github.com/authlib-jwt-bearer-grant-accepts-assertions-for-wrong-audience-12635|advisory]]). - **Vikunja 2.0.0–2.7.0**: the OIDC callback accepted cross-site form-encoded posts, giving login CSRF into the attacker's account ([[raw/github.com/vikunja-accepts-form-encoded-bodies-on-login-and-oidc-callback-13700|advisory]]). - **Vikunja 1.0.0–<2.8.0 (CVE-2026-134284)**: with `emailfallback` enabled, an attacker registers or edits a local account to carry the victim's unverified email, and the victim's first OIDC login links into that attacker-controlled account (pre-account hijacking) ([[raw/github.com/vikunja-account-takeover-vulnerability-15982|advisory]]). - **Better Auth 0.4.9–<1.7.16 (CVE-2026-134312)**: OAuth sign-in treated unverified provider emails as verified, including the string `"false"` for `email_verified`, and did not check generic-OAuth profile vs ID-token `sub` mismatches. An attacker holding the victim's address unverified at a provider could link into the victim's local account ([[raw/github.com/better-auth-oauth-signature-issue-high-15981|advisory]]). - **Spec level (CVE-2025-27370/27371)**: audience ambiguity in private-key JWT client authentication across the OpenID and OAuth specs ([[raw/guptadeepak.com/sso-protocol-security-critical-vulnerabilities-in-saml-oauth-oidc-jwt-4718|survey]]). ## Defenses - Validate ID tokens fully (signature via discovery/JWKS, `iss`, `aud`, `exp`, `nonce`) with a maintained library ([[raw/cheatsheetseries.owasp.org/owasp-authentication-cheat-sheet-3897|OWASP]]). - Only link a federated login to an existing local account whose email was itself verified, and type-check `email_verified` as a boolean ([[raw/github.com/vikunja-account-takeover-vulnerability-15982|Vikunja]], [[raw/github.com/better-auth-oauth-signature-issue-high-15981|Better Auth]]). - Key federated identities on `iss`+`sub`. Never auto-link on email or profile claims. Require re-authentication, bind the linking flow to the session, and notify on link and unlink ([[raw/cheatsheetseries.owasp.org/owasp-authentication-cheat-sheet-3897|OWASP]]). - For Google Workspace logins, check `hd`, but don't treat it as unique. Consider disabling JIT provisioning or enforcing SAML/SSO at the org level ([[raw/trufflesecurity.com/google-oauth-is-broken-sort-of-7002|Truffle Security]]). - Apply tenant/domain constraints on **every** provisioning and sign-in path in multi-IdP pools ([[raw/blog.doyensec.com/the-danger-of-multi-sso-aws-cognito-user-pools-11460|Doyensec]]). - Cloud trust policies: always condition on `aud` and a precise `sub`, plus vendor-specific claims ([[raw/wiz.io/avoiding-mistakes-with-aws-oidc-integration-conditions-9491|Wiz]]). - Authenticate dynamic registration, and egress-filter server-side metadata fetches ([[SSRF Prevention]]). ## Related - [[Authentication Security]] · [[OAuth 2.0 Vulnerabilities]] · [[SAML Attacks]] · [[Account Takeover]] - [[JSON Web Tokens]] · [[JWT None Algorithm]] · [[Multi-Tenant Isolation]] · [[GitHub Actions Security]] · [[Secrets Management]] · [[API Security]] · [[Python Security]] ## Sources - [[raw/cheatsheetseries.owasp.org/owasp-authentication-cheat-sheet-3897|OWASP Authentication Cheat Sheet]] - [[raw/developer.okta.com/an-illustrated-guide-to-oauth-and-openid-connect-6993|An Illustrated Guide to OAuth and OpenID Connect]] - [[raw/blog.doyensec.com/doyensec-common-oauth-vulnerabilities-3891|Doyensec: Common OAuth Vulnerabilities]] - [[raw/trufflesecurity.com/google-oauth-is-broken-sort-of-7002|Google OAuth is broken (sort of)]] - [[raw/blog.doyensec.com/the-danger-of-multi-sso-aws-cognito-user-pools-11460|The Danger of Multi-SSO AWS Cognito User Pools]] - [[raw/medium.com/a-token-can-be-valid-and-still-not-be-meant-for-your-api-15115|A token can be valid and still not be meant for your API]] - [[raw/github.com/authlib-jwt-bearer-grant-accepts-assertions-for-wrong-audience-12635|Authlib JWT bearer grant accepts assertions for wrong audience]] - [[raw/cvereports.com/cve-2026-1529-bypassing-keycloak-org-security-4954|CVE-2026-1529: Bypassing Keycloak Org Security]] - [[raw/zeropath.com/oauth-sso-wordpress-plugin-jwt-bypass-cve-2025-9485-4721|OAuth SSO WordPress Plugin JWT Bypass (CVE-2025-9485)]] - [[raw/github.com/vikunja-accepts-form-encoded-bodies-on-login-and-oidc-callback-13700|Vikunja accepts form-encoded bodies on login and OIDC callback]] - [[raw/wiz.io/avoiding-mistakes-with-aws-oidc-integration-conditions-9491|Avoiding mistakes with AWS OIDC integration conditions]] - [[raw/docs.github.com/oidc-security-hardening-for-github-actions-4060|OIDC Security Hardening for GitHub Actions]] - [[raw/portswigger.net/portswigger-hidden-oauth-attack-vectors-4082|PortSwigger: Hidden OAuth attack vectors]] - [[raw/guptadeepak.com/sso-protocol-security-critical-vulnerabilities-in-saml-oauth-oidc-jwt-4718|SSO Protocol Security: Critical Vulnerabilities in SAML, OAuth, OIDC, JWT (2025)]] - [[raw/github.com/vikunja-account-takeover-vulnerability-15982|Vikunja account takeover vulnerability]] - [[raw/github.com/better-auth-oauth-signature-issue-high-15981|Better Auth OAuth signature issue (high)]]