Summary
Coder's OIDC callback previously misinterpreted the email_verified claim, treating non-boolean or missing values as verified and enabling authentication bypass.
Combined with permissive email-based account fallback, this behavior could allow an attacker to take over accounts if they can control or influence IdP claims.
Affected context
This vulnerability affects Coder deployments that use OIDC identity providers for user authentication and rely on the email_verified claim to gate account linking and login.
It is relevant in contexts where IdPs may return email_verified as a string or numeric type, or omit it entirely, and where email-based fallback is allowed to associate identities.
The issue is most pronounced in multi-IdP or shared email environments, and when administrators assume that Coder strictly enforces email_verified as a boolean for verification decisions.
Exploit preconditions
- Attack surface: Coder OIDC callback endpoint used during login and account linking.
- Required access: Ability to authenticate via an IdP integrated with Coder and control or influence the
email_verifiedclaim (e.g., custom or misconfigured IdP, or compromised IdP tenant). - Trigger point: Submission of an OIDC authentication flow where
email_verifiedis returned as a non-boolean value (such as the string"false") or omitted, combined with an email that matches an existing Coder account. - Why exploitation is possible: The Go code used a direct boolean type assertion on
email_verified. When the claim was not a native JSON boolean, the assertion failed open, treating the email as verified, while an unconditional email-based fallback allowed linking or logging in to an existing account.
Why this happens
The underlying bug stems from improper validation of authentication claims and type handling in the OIDC callback logic.
Instead of coercing or strictly validating the email_verified claim, the implementation performed a direct Go bool type assertion on a potentially polymorphic JSON value.
This behavior aligns with CWE-704: Incorrect Type Conversion or Cast, where unsafe type assumptions on external input cause logic errors, and CWE-287: Improper Authentication, where authentication decisions are made without correctly verifying the asserted identity.
Because the failure case implicitly treated the email as verified and combined with unconditional email-based account fallback, the system created an insecure pattern in which trust in the IdP claim was overstated, allowing unintended account association and takeover.
Potential impact
- An attacker may take over existing Coder accounts by leveraging an IdP that returns
email_verifiedas a string, number, or omits it. - Attackers could gain access to remote development environments, associated Terraform-managed resources, and any secrets or credentials stored within those environments.
- Compromised accounts can be used to modify infrastructure configurations, inject malicious code into development workflows, or exfiltrate sensitive source code.
- Attacker-controlled sessions could enable lateral movement within an organization's development tooling ecosystem that is integrated with Coder.
General mitigation guidance
Effective mitigation focuses on enforcing strict, fail-closed authentication logic and reducing reliance on ambiguous identity attributes.
Recommended patterns include:
- Normalizing and validating external identity claims across supported types, rejecting or treating as unverified any
email_verifiedvalues that are not explicit booleans or that cannot be safely coerced. - Designing authentication flows so that verification checks fail closed: if a claim is missing, malformed, or of an unexpected type, the system should deny login or linking rather than assuming success.
- Minimizing or removing automatic email-based account fallback for identity linking, especially when another stable identifier (IdP subject) is available, and ensuring that one account cannot be silently linked to different IdP subjects.
- Separating identity attributes used for login decisions from those used for user convenience, and avoiding treating email alone as a primary, unverified key for account ownership.
- Applying least-privilege principles to remote development environments so that, even if an account is compromised, the accessible resources and operations are constrained.
How teams detect issues like this
Detection typically involves a combination of code-centric and operational controls:
- Static analysis rules or linters that flag direct type assertions on untrusted JSON claims in authentication code, especially around fields like
email_verified,sub, or other key identity attributes. - Manual code review focused on OIDC and SSO integration paths, looking for logic that assumes claim types without validation, or that falls back to email-based account linking without strict checks on IdP subject consistency.
- Runtime logging and monitoring of OIDC callback behavior, including recording claim types and values for
email_verified, and alerting when non-boolean types are observed or when account links are created via fallback logic. - Policy-based enforcement in CI/CD pipelines that require explicit validation functions for identity claims and prohibit fail-open patterns in authentication-related code paths.
- Optional use of automated security review tools that specialize in auth and identity flows, configured to search for CWE-287 and CWE-704 patterns in the codebase.

