Advisory

GHSA-6g38-8j4p-j3pr

Details, part 2 of 2. The advisory

Details

Fix: Add EmailVerified bool \json:"email_verified"`` to the struct and map it correctly.

Attack Scenario (Discord)

Setup: An Nhost application uses Discord OAuth. A victim has an account with [email protected].

  1. Attacker opens Discord → User Settings → Account, changes email to [email protected], and dismisses the dialog, without clicking the confirmation link.
  1. At this point Discord's API returns "email": "[email protected]", "verified": false for the attacker's account.
  1. Attacker visits the target application and clicks Sign in with Discord.
  1. Nhost fetches the Discord profile. The missing Verified field in the struct causes the JSON decoder to drop it. The adapter sets EmailVerified: true because "[email protected]" != "".
  1. Nhost finds the victim's account by email, sees no Discord provider row linked to it, and calls InsertUserProvider to link the attacker's Discord ID.
  1. Nhost issues a full session for the victim's account and returns it to the attacker.
  1. The attacker is now authenticated as the victim.

The attack is silent, the victim receives no notification and the session appears entirely legitimate.

Defense-in-Depth Gap (Informational)

Several other providers also use EmailVerified: email != "", the same logical pattern as the vulnerable ones above. However, these are not currently exploitable because the platforms themselves enforce email verification before returning an address in the API response:

|Provider|API Field Used|Why Not Exploitable Today|
|---|---|---|
|Twitch|email string only|Twitch requires email verification at sign-up; the API never returns an unverified email|
|GitLab|email string only|GET /api/v4/user only returns the confirmed primary email|
|Facebook|email via Graph API|Facebook only includes email in the response when it is confirmed|
|Twitter|email via verify_credentials|Twitter requires a working email address on the account|
|Spotify|email string only|Spotify enforces verification before account activation|
|Windows Live|preferred account email|Microsoft's Live API only surfaces confirmed addresses|
|WorkOS|email from SSO profile|Controlled by the enterprise IdP|

These providers happen to be safe due to external platform behavior, not due to any validation in Nhost's code. The email != "" shortcut is fragile:

  • If any of these platforms change how their API works, Nhost silently becomes exploitable for that provider.
  • Any developer adding a new provider in the future will likely copy the same pattern, believing it is the established convention, creating vulnerabilities in new integrations.

For this reason, the controller-level guard in Layer 1 of the fix below is important even beyond the four currently vulnerable providers: it makes the system safe by design regardless of what any individual adapter returns.

Impact

  • Full account takeover of any existing Nhost user.
  • Requires no interaction from the victim.
  • Attacker can change the account email, disable other login methods, and permanently lock out the legitimate owner.
  • Severity escalates to Critical in applications with admin or privileged accounts.

Sources & licences