Skip to main content
Menu
Advisories

Account takeover via email_verified bypass in social account linking (Azure AD, OAuth2 connectors)

GHSA-GC94-XQG8-V8R7Published Updated GitHub

Description

Important

Action required: upgrading alone does not remove the exposure.

The fix is a configuration option, not a change of default. Logto 1.46.0 adds a disableEmailSync option to the OAuth 2.0 connector (@logto/connector-oauth 1.8.0). The Azure AD connector has had the same option since 1.43.0. Both default to false, so the connector keeps using the email its provider returns until an administrator turns the option on.

If you use the OAuth 2.0 or Azure AD connector with a provider that does not verify email addresses, or lets a user or directory administrator set the email freely, upgrade to 1.46.0 and enable disableEmailSync on that connector. The Google, GitHub and OIDC connectors are not affected, because they only return an email that the provider marks as verified.

---

Summary

When a social sign-in finds an existing account by email, Logto links the social identity and signs the user in without checking whether the social provider asserted the email as verified. An attacker who can present a social identity carrying a victim's email (without owning that mailbox) can take over the victim's account.

The matching SSO path already guards this (email_verified ?? trustUnverifiedEmail), and the GitHub connector correctly uses only the verified && primary email — so the social path looks like an oversight rather than intended behavior.

Validated end-to-end locally against svhd/logto:latest (core 1.40.1).

Where (core 1.40.1)

  • packages/core/src/libraries/social.ts → findSocialRelatedUser does findUserByEmail(info.email) with no email_verified check.
  • packages/core/src/routes/experience/classes/helpers.ts (case VerificationType.Social): when linkSocialIdentity is true it uses identifyRelatedUser() (the email-matched user).
  • packages/core/src/routes/experience/classes/experience-interaction.ts identifyUser() only calls guardIdentificationMethod (method-enablement) — no email-verification gate and no proof of ownership of the matched account.
  • linkSocialIdentity is a client-supplied request body field (routes/experience/index.ts, POST /api/experience/identification).

Connectors that let an attacker carry an unverified/attacker-set email:

  • connector-azuread → email: conditional(mail) (Microsoft Graph mail is mutable/unverified — the classic nOAuth pattern).
  • The standard connector-oauth2 → surfaces whatever the configured userInfo endpoint maps to email via profileMap, with no verification check. (This is the connector I used in the PoC.)

(Contrast, safe by default) connector-github (verified && primary), connector-google and connector-oidc only emit the email when the provider marked it verified — so they are not affected unless an admin explicitly opts into trustUnverifiedEmail (OIDC). This is exactly why the social-linking path should be checking verification too.

Validated PoC

(all on localhost, docker compose from the repo)

  1. Created a victim user victim@example.com (Management API).
  2. Configured a standard OAuth2 social connector pointing at a tiny mock IdP I control, whose /userinfo returns { sub: "attacker-sub-001", email: "victim@example.com" } — no email_verified field (models nOAuth / an unverified-email IdP).
  3. Drove the sign-in experience as the "attacker": social verification (Logto fetched my /userinfo), then POST /api/experience/identification with { verificationId, linkSocialIdentity: true } → 204, then POST /api/experience/submit → 200 with a completed sign-in.
  4. The victim account's identities now contains the attacker's social identity:

``json "pocoauth2": { "userId": "attacker-sub-001", "details": { "email": "victim@example.com", ... } } ``

The attacker is now signed in as — and permanently linked to — the victim's account.

(Happy to share the mock-IdP + driver script; it's ~3 small files.)

Impact

Account takeover. Severity depends on the tenant's connectors: tenants using the Azure AD connector (nOAuth) or a standard OAuth2 connector against an IdP that doesn't verify emails are exploitable; Google/GitHub/OIDC connectors are not (they only surface verified emails). This affects both self-hosted Logto and, where such connectors are enabled, Logto Cloud (a tenant boundary).

Same class as nOAuth (Microsoft), Nhost (GHSA-6g38-8j4p-j3pr), and Reviactyl (CVE-2026-34456).

Suggested fix

Per the maintainer's confirmed approach: extend the trustUnverifiedEmail config flag (already on the OIDC connector since v1.36.0) to the Azure AD and OAuth2 connectors. The flag appears in the connector form when creating a new connector, defaulting to off, so new connectors only use the email when the provider asserts it as verified. Each connector's getUserInfo respects the flag.

For backward compatibility, connectors that don't have the setting (i.e. all existing ones) are treated as trusted, so current integrations keep working unchanged. Admins who don't trust their IdP's email handling can simply turn the flag off.

Happy to take the PR through the temporary private fork.

---

Reporter: JebeenLee

References

GitHub · logto-io/logto