Summary
Coder's OIDC login flow contained two authentication logic flaws that could be chained into full account takeover.
Under certain identity provider configurations, attackers could abuse email-based account linking and misinterpreted email_verified claims to gain access to existing user accounts.
Affected context
This vulnerability affects deployments of Coder that use OpenID Connect (OIDC) for user authentication and account linking.
It is most relevant where:
- Coder relies on email address matching for linking identities.
- The IdP allows self-registration or issues tokens without strictly enforced email verification.
email_verifiedclaims may be missing, incorrectly typed, or loosely validated.
In such environments, the flawed logic around account linking and email verification can be abused to bind an attacker-controlled identity to an existing Coder account.
Exploit preconditions
- Attack surface: Coder web application OIDC login and account linking endpoints.
- Required access: Ability to authenticate via the configured OIDC provider using an email address that matches a target user's email, or to register such an account if self-signup is permitted.
- Trigger point: Initiation of the OIDC login flow, where Coder processes the IdP token, evaluates
email_verified, and performs email-based account matching and linking. - Why exploitation is possible: The application:
- Falls back to linking accounts purely by email without confirming that the existing account is already linked to a different IdP subject.
- Treats the
email_verifiedclaim as verified when it is absent or not a boolean, effectively bypassing email verification checks.
Why this happens
The underlying issue stems from flawed authentication and identity-linking logic, aligning with CWE-287 (Improper Authentication) and CWE-289 (Authentication Bypass by Alternate Name).
Coder's OIDC integration trusted email-based identity matching as a fallback without enforcing uniqueness of the IdP subject for existing accounts, allowing an alternate identity to attach to a known email.
Additionally, the handling of the email_verified claim did not follow a secure default: only an explicit boolean false was treated as unverified, while missing or malformed claims were implicitly treated as verified.
Together, these patterns undermine the assurance that a logged-in OIDC user is the legitimate owner of the corresponding Coder account.
Potential impact
- Attackers may take over existing Coder user accounts if they control or can register an email matching the victim's address.
- Compromise of remote development environments, including access to source code, credentials, and infrastructure Terraform templates.
- Escalation to administrative control within Coder if a privileged account is targeted.
- Lateral movement into connected systems or CI/CD pipelines configured within compromised environments.
General mitigation guidance
Effective mitigation focuses on hardening identity linking and enforcing strict verification of authentication claims:
- Avoid using email-only matching as a primary linking mechanism; bind accounts to stable, unique IdP subject identifiers and enforce one-to-one relationships.
- Apply secure defaults for claims such as
email_verified: treat missing, malformed, or unexpected types as unverified and require explicit positive confirmation. - Require strong assurance from the OIDC provider, including mandatory email verification before token issuance and disabling anonymous or self-service registration where feasible.
- Implement defense-in-depth controls such as step-up authentication or secondary confirmation before linking new identities to existing accounts.
- Limit the privileges granted to newly linked accounts and monitor account-linking operations more tightly than standard logins.
How teams detect issues like this
Detection can rely on a combination of configuration review, code analysis, and runtime monitoring:
- Use code review or static analysis to locate authentication flows that rely on email-based linking, weak claim validation, or ambiguous handling of
email_verifiedand similar trust signals. - Define internal patterns that flag any fallback matching logic that does not check existing IdP subjects or that treats missing claims as implicitly trusted.
- Review OIDC provider and application configuration to ensure email verification requirements and registration policies conform to organizational security standards.
- Monitor authentication and account-linking logs for suspicious patterns, such as frequent linking attempts, multiple identities bound to a single email, or new IdP subjects appearing for established accounts.
- Automated security testing tools can be configured to exercise OIDC flows with malformed or missing claims to catch insecure defaults early in CI pipelines.

