Executive Intelligence Brief

A critical vulnerability (CVE-2026-49757, CVSS 9.2) has been discovered in AshAuthentication's OAuth2 and OIDC strategies. This vulnerability allows for unauthenticated remote account takeover via email-based user matching. Affected applications are those that use AshAuthentication with OAuth2/OIDC configurations that do not strictly verify email ownership. An attacker can exploit this by registering an account with a victim's email on a vulnerable provider and then gaining full local privileges through a standard OAuth flow. Immediate patching or mitigation is strongly recommended.

Threat Overview

AshAuthentication is a popular authentication library for Elixir applications. Its OAuth2 and OIDC strategies are widely used for secure authentication. However, a critical vulnerability has been identified that compromises the security of these strategies. The vulnerability stems from the library's reliance on email addresses for user matching, rather than the more secure OpenID Connect `iss`/`sub` claim combination. This oversight allows attackers to potentially take over user accounts if they can register with the victim's email on an OAuth/OIDC provider that does not strictly verify email ownership.

Technical Deep Dive

Vulnerability Classification

The vulnerability is classified under CWE-287: Improper Authentication. It occurs because AshAuthentication's OAuth2/OIDC strategies use email addresses for user matching, which is not in line with OpenID Connect Core ยง5.7 recommendations. According to these recommendations, only the `iss`/`sub` claim combination should be used as a unique identifier for end-users.

Root Cause Analysis

The root cause of this vulnerability is the improper use of email addresses as unique identifiers in AshAuthentication's OAuth2/OIDC strategies. Specifically, the `upsert_identity` action in `'Elixir.AshAuthentication.Strategy.OAuth2.IdentityChange':change/3` and the sign-in preparation in `'Elixir.AshAuthentication.Strategy.OAuth2.SignInPreparation':prepare/3` contribute to the vulnerability by not verifying the returned user against an `iss`/`sub` identity.

Attack Vector & Chain

The attack vector involves an unauthenticated attacker registering an account with a victim's email on an OAuth/OIDC provider that does not strictly verify email ownership. The attacker then completes the standard OAuth flow against the AshAuthentication application, which results in the attacker being authenticated as the victim due to the flawed user matching logic.

Exploitation Scenario Walkthrough

Scenario: OAuth2/OIDC Account Takeover via Email Matching

Reconnaissance: An attacker identifies a vulnerable AshAuthentication application that uses OAuth2/OIDC strategies with providers that do not strictly verify email ownership.

Weaponization: The attacker registers an account with the victim's email on the identified provider.

Delivery & Exploitation: The attacker completes the standard OAuth flow against the AshAuthentication application. The application, due to its flawed logic, matches the attacker with the victim's account based on the email address.

Post-Exploitation: The attacker gains full local privileges of the victim's account, including read, write, and destructive access.

Impact Realization: The attacker can now perform actions as the victim, potentially leading to unauthorized data access, modification, or further exploitation.

Exploitation in the Wild

There is no indication that this vulnerability is currently being actively exploited in the wild. However, given its severity and the potential for exploitation, it is essential for organizations using affected versions of AshAuthentication to apply patches or mitigations immediately.

Impact Analysis

Direct Impact

The direct impact of this vulnerability is the potential for unauthenticated remote account takeover. An attacker can gain full control over a victim's account, leading to unauthorized access and potential misuse of the account's privileges.

Downstream & Cascading Effects

The downstream effects could include unauthorized data access, data breaches, or further exploitation of the compromised account to gain access to other systems or services.

Affected Products & Versions

AshAuthentication versions prior to the patched versions (4.x backport: 728b8d28c1b5f465fa1116ef044a815300fc733d, 5.x: 64530644f9b37ebb76ca14aeb83a77597a0034b7) are affected. Users should update to the latest patched version to mitigate this vulnerability.

Detection & Threat Hunting

Indicators of Compromise

Indicators of compromise may include unusual login activities, especially from unknown or suspicious IP addresses, or changes in account settings that were not initiated by the account owner.

Detection Rules & Signatures

Detection rules should focus on monitoring OAuth2/OIDC login attempts, especially those that result in unusual or unauthorized access patterns. Monitoring for changes in user account settings or privileges can also help identify potential exploitation.

Threat Hunting Queries

Threat hunting queries should target login logs, OAuth2/OIDC transaction logs, and user account activity logs to identify any suspicious patterns that could indicate exploitation of this vulnerability.

Remediation & Hardening

Immediate Actions (0-24 hours)

Apply the patches provided by AshAuthentication (4.x backport: 728b8d28c1b5f465fa1116ef044a815300fc733d, 5.x: 64530644f9b37ebb76ca14aeb83a77597a0034b7) to prevent exploitation. For immediate mitigation, consider temporarily disabling affected OAuth2/OIDC strategies until patches can be applied.

Short-Term Hardening (1-7 days)

In addition to patching, ensure that all OAuth2/OIDC providers used by AshAuthentication strictly verify email ownership. Implement additional monitoring and logging to detect suspicious login activities.

Strategic Recommendations

Long-term, consider enhancing authentication mechanisms to use more secure identifiers than email addresses for user matching, such as the OpenID Connect `iss`/`sub` claim combination. Regularly review and update authentication configurations to ensure they align with the latest security best practices.

Analyst Assessment

This vulnerability is considered critical due to its potential for unauthenticated remote account takeover. Given its severity and the potential impact, organizations using affected versions of AshAuthentication should prioritize patching or applying mitigations immediately. The likelihood of exploitation is considered high, especially given the widespread use of OAuth2/OIDC strategies in modern applications.

Sources

  • GitHub Security Advisories: https://github.com/advisories/GHSA-777c-2fxx-qr28