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
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 (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,audandexp(OWASP). A token can be correctly signed and unexpired and still not be meant for your service. Audience and issuer are what scope it (audience note). Skipped signature or nonce checks in libraries have led to full impersonation (CVE-2020-26244, CVE-2024-10318) (survey). - Identity keying:
subhas no standard format, so apps fall back toemailor handles. Some providers don’t guarantee those are immutable or verified. That gives “mutable claims” ATO (Doyensec). Even Google documents that email shouldn’t be the identifier. Itshd(hosted domain) claim is just a domain, not a unique ID, so a re-registered domain inherits old logins (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 onemail/preferred_username, require an authenticated and re-authenticated session to add a link, validate the new ID token, and notify the user (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 (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
subcondition, any GitHub user’s workflow could assume the role (Wiz, GitHub docs). - Discovery and registration: discovery documents and dynamic client registration turn
jwks_uri,request_urisandlogo_uriinto server-side fetches (SSRF) (PortSwigger Research).
What to check
- Which claim keys the local account? (
iss+subis correct.email,upn,preferred_usernameorsubalone across several IdPs is a finding.) - Is
email_verifiedhonored, 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 withoutnonce, 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
audand an exactsub(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 (Truffle Security).
- AWS OIDC trust conditions: GitHub Actions roles without a
subcondition were assumable from any repo. Similar required conditions exist across 20+ vendors (Terraform Cloud, GitLab, Defender) (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 (Doyensec).
- miniOrange OAuth SSO for WordPress ≤6.26.12 (CVE-2025-9485): ID-token signatures were never verified, so a forged
subgave admin (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 (writeup).
- Authlib (GHSA-fch4-3c6x-j4gc): an empty
get_audiences()made the RFC 7523 bearer grant accept assertions meant for other audiences (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 (advisory).
- Vikunja 1.0.0–<2.8.0 (CVE-2026-134284): with
emailfallbackenabled, 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) (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"foremail_verified, and did not check generic-OAuth profile vs ID-tokensubmismatches. An attacker holding the victim’s address unverified at a provider could link into the victim’s local account (advisory). - Spec level (CVE-2025-27370/27371): audience ambiguity in private-key JWT client authentication across the OpenID and OAuth specs (survey).
Defenses
- Validate ID tokens fully (signature via discovery/JWKS,
iss,aud,exp,nonce) with a maintained library (OWASP). - Only link a federated login to an existing local account whose email was itself verified, and type-check
email_verifiedas a boolean (Vikunja, 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 (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 (Truffle Security). - Apply tenant/domain constraints on every provisioning and sign-in path in multi-IdP pools (Doyensec).
- Cloud trust policies: always condition on
audand a precisesub, plus vendor-specific claims (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
- OWASP Authentication Cheat Sheet · original
- An Illustrated Guide to OAuth and OpenID Connect · original
- Doyensec: Common OAuth Vulnerabilities · original
- Google OAuth is broken (sort of) · original
- The Danger of Multi-SSO AWS Cognito User Pools · original
- A token can be valid and still not be meant for your API · original
- Authlib JWT bearer grant accepts assertions for wrong audience · original
- CVE-2026-1529: Bypassing Keycloak Org Security · original
- OAuth SSO WordPress Plugin JWT Bypass (CVE-2025-9485) · original
- Vikunja accepts form-encoded bodies on login and OIDC callback · original
- Avoiding mistakes with AWS OIDC integration conditions · original
- OIDC Security Hardening for GitHub Actions · original
- PortSwigger: Hidden OAuth attack vectors · original
- SSO Protocol Security: Critical Vulnerabilities in SAML, OAuth, OIDC, JWT (2025) · original
- Vikunja account takeover vulnerability · original
- Better Auth OAuth signature issue (high) · original