Summary
Logto can use an unverified email from certain OAuth 2.0 or Azure AD connectors to match a social identity to an existing local account. If an attacker controls that provider email and social linking is enabled in the identification request, they may link their identity to a victim's account and sign in as the victim.
Affected context
The issue affects Logto deployments using the standard OAuth 2.0 or Azure AD connector when email synchronization is enabled and the provider does not verify email ownership or lets users set the email value freely. The vulnerable matching can occur during social account linking through POST /api/experience/identification when linkSocialIdentity is enabled. Google, GitHub, and the default OIDC connector behavior are not affected as described because those paths expose only verified email.
Exploit preconditions
- Attack surface: Social sign-in and account linking through Logto's identification flow
- Required access: The attacker must be able to authenticate with a social identity whose provider email is unverified or freely settable; prior access to the victim's account is not described as necessary.
- Trigger point: A request to
POST /api/experience/identificationwithlinkSocialIdentityenabled, followed by email-based matching to an existing local account - Why exploitation is possible: The connector-provided email is trusted for account matching without sufficient assurance that the attacker controls the corresponding email address.
Why this happens
Logto uses an email value returned by certain social identity providers to locate an existing local account and link the provider identity. When that value is not verified, treating it as proof of email ownership is an authentication and identity-verification failure. This maps primarily to CWE-287: Improper Authentication and also relates to CWE-345: Insufficient Verification of Data Authenticity.
Potential impact
- An attacker could link an attacker-controlled social identity to a victim's local account.
- The attacker may be able to sign in as the victim.
- The victim's account and associated data could be exposed or misused.
General mitigation guidance
Mitigation generally focuses on requiring trustworthy proof of email ownership before using an email address for account matching or linking.
Common defensive patterns include:
- Accepting email-based matching only when the provider asserts that the email is verified.
- Requiring an independent verification step before linking an identity to an existing account.
- Making email synchronization and trust behavior explicit per connector, and enabling suitable verification controls where available.
- Avoiding automatic account linking based solely on a provider-supplied email value.
- Applying least privilege to linked identities and providing users with clear ways to review and revoke linked accounts.
How teams detect issues like this
High-level detection approaches include:
- Reviewing account-linking code for matches based on email values without checking a trustworthy verification claim.
- Using static analysis or code review rules to flag identity matching that relies on unverified provider attributes.
- Auditing connector configuration and policies for whether email synchronization or linking is enabled without verification requirements.
- Monitoring for newly linked social identities on existing accounts, especially when the provider's email is not verified.
- Enforcing policies that require verified identity attributes before automatic account linking.

