/

CVE-2026-44166

Severity:

HIGH RISK

(7.6)

Authentication Bypass in PocketBase

CVE-2026-44166

Analyzed

Vulnerability type

Category:

Authentication Bypass

CWE:

CWE-287

Impact:

Account Takeover / Authentication Integrity Compromise

Severity:

HIGH RISK

(7.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PocketBase's OAuth auto-linking logic allowed an attacker who knows a victim's email address to pre-create an unverified PocketBase user using one OAuth provider, and have it automatically linked and verified when the victim signs up later with a different provider.

Under these conditions, the attacker's pre-created account could be upgraded to a verified state and gain control over the victim's application identity, including resetting the original password.

Affected context

This vulnerability affects PocketBase deployments that:

  • Use OAuth2 authentication providers for user sign-in and sign-up flows
  • Permit sign-ups by email address with different OAuth providers (e.g., provider A and provider B)
  • Automatically link OAuth accounts to existing PocketBase users based primarily on email without strong verification of account origin or prior ownership

The issue manifests when:

  • An attacker can anticipate or discover a victim's email address
  • The system auto-links a later OAuth sign-up from a different provider to a pre-existing, attacker-created PocketBase user record.

Exploit preconditions

  • Attack surface: Public-facing PocketBase applications that expose OAuth sign-up and sign-in endpoints.
  • Required access:
  • Ability to register/sign in with an OAuth provider supported by the application.
  • Knowledge of the victim's email address (e.g., by guesswork, enumeration, or social interaction).
  • Trigger point:
  • The victim later signs up or accepts an invitation using a different OAuth provider with the same email.
  • The PocketBase backend auto-links the victim's OAuth identity to the pre-existing, attacker-controlled PocketBase user.
  • Why exploitation is possible:
  • The auto-linking logic treats matching email addresses across different OAuth providers as proof of identity equivalence.
  • The system does not adequately differentiate between legitimate user-created accounts and pre-created accounts by an attacker using the same email but a different provider.
  • Once auto-linked, the existing, attacker-created user is upgraded to verified and its password reset path is effectively attached to the victim's new OAuth identity.

Why this happens

The underlying bug falls under CWE-287: Improper Authentication, rooted in flawed assumptions about identity linking across OAuth providers.

The auto-linking mechanism implicitly trusted that any OAuth account presenting a given email address corresponds to the same real-world user and that pre-existing accounts with that email are legitimate. This trust allowed an attacker to:

  • Pre-create a PocketBase user using OAuth provider A with the victim's email.
  • Rely on PocketBase's rule that a single PocketBase user cannot have multiple accounts from the same provider, forcing the victim to use provider B.
  • Have the victim's later authentication with provider B auto-link to the pre-created account based on email, thereby converting the attacker-created user into a verified, primary identity.

Abstractly, this is an identity binding flaw where the system's authentication logic did not enforce robust ownership or verification checks when binding multiple external identities (different OAuth providers) to a single internal account.

Potential impact

  • Attacker-controlled pre-created accounts may be upgraded to verified status when victims sign up, leading to effective account takeover.
  • Victims may lose exclusive control of their application profile, including data, settings, and associated resources.
  • The attacker may reset or influence credentials associated with the now-verified account (such as application-level passwords).
  • Misattribution of actions and data to the wrong identity, causing audit trail confusion and compliance issues.
  • Potential escalation into broader compromise if the affected user account has elevated privileges (e.g., admin or operator roles).

General mitigation guidance

Effective mitigation focuses on hardening identity linking and verification rules rather than relying solely on email matching:

  • Tighten account linking rules:
  • Treat any auto-linking between accounts from different OAuth providers as a privileged operation requiring additional checks (e.g., explicit confirmation or email verification).
  • Ensure that unverified or pre-existing accounts created via OAuth cannot be silently upgraded based solely on an email match.
  • Strengthen email ownership verification:
  • Require independent email verification (e.g., out-of-band confirmation) before linking multiple OAuth identities to a single internal user record.
  • Avoid treating email provided by OAuth claims as fully trusted for linking, especially when an account already exists for that email.
  • Constrain automatic account creation:
  • Limit or disable automatic creation of user records without explicit user interaction or confirmation when using social/OAuth logins.
  • Introduce policies where invitations or sign-ups must confirm ownership of the email before finalizing account state changes.
  • Enforce least-privilege identity changes:
  • Restrict what can happen when linking identities (e.g., prevent automatic verification or password changes without user-driven consent).
  • Ensure verification status and credential reset capabilities cannot be altered through implicit flows triggered by another provider's login.

These patterns help ensure that external identity providers cannot be used to hijack or preempt legitimate user accounts through email-based assumptions alone.

How teams detect issues like this

Detection should focus on identifying risky identity-linking behaviors and patterns in authentication logic:

  • Static analysis and code review:
  • Look for code paths where OAuth identities are auto-linked to existing users based primarily on email or other non-strong identifiers.
  • Flag any logic that upgrades user states (e.g., verified = true, password reset, role elevation) as a side effect of login or linking flows without explicit user confirmation.
  • Review constraints around multiple OAuth providers per user and ensure they are not leading to assumptions about identity equivalence.
  • Behavioral and audit logging:
  • Implement detailed logs for:
  • Account creation events via OAuth, especially when an email already exists in the system.
  • Changes in user verification status and primary credential paths.
  • Linking or merging of accounts across different OAuth providers.
  • Periodically audit logs to detect patterns such as:
  • Multiple accounts created for the same email with different providers.
  • Unusual sequences where an unverified account becomes verified directly after a different provider login.
  • Policy enforcement tools:
  • Use automated policy checks in CI/CD that prevent merging code introducing new auto-link behaviors without additional verification steps.
  • Introduce unit and integration tests that simulate pre-created accounts and subsequent sign-ups with different providers, asserting that verification and control do not silently shift.

By combining code-level analysis with operational monitoring, teams can catch similar identity-binding flaws early and prevent regressions.

Sources

SourceLink
github.comgithub.com/pocketbase/pocketbase/security/advisories/GHSA-pq7p-mc74-g65w

Frequently asked

questions

Exploitability is constrained by the need for the attacker to know the victim's email and to be able to register via an OAuth provider supported by the application. However, for public-facing applications where emails can be guessed or known, the risk is significant because the attack can be carried out remotely without prior access to the victim's account.

The attacker typically only needs access to the standard OAuth sign-up/sign-in routes, just like any normal user. No elevated privileges are required; the abuse occurs within normal authentication flows by pre-creating an account using the victim's email and a different OAuth provider.

The safest pattern is to require explicit, user-driven confirmation whenever linking or merging identities from multiple OAuth providers, and to avoid upgrading verification status or changing credentials based solely on email matches. Additionally, auto-linking should be constrained so that existing accounts cannot be silently claimed or upgraded through new provider logins.

Prevention relies on designing authentication flows around strong ownership proofs and least-privilege principles. Treat email as a hint, not proof of identity; require separate verification before binding providers; introduce explicit user consent for merging identities; and continuously review and test authentication and account-linking logic as part of secure design and code review practices.

Find out what's already
exploitable in your codebase.