Summary
In affected LibreChat deployments, an unauthenticated attacker may be able to plant a forged provider value for a known user's email when local registration is enabled and a social login provider is configured. If the victim later signs in through that provider, an insufficiently verified email-fallback path can link the victim's OAuth session and the attacker's password-based session to the same account, enabling persistent access to the victim's data.
Affected context
The issue affects LibreChat deployments in the described version range from 0.7.0 up to, but not including, 0.8.6, when local registration is enabled and at least one social provider is configured. The risk involves registration handling in AuthService.js and the email-fallback logic in socialLogin.js. The first-user administrator role is an additional conditional impact limited to fresh deployments.
Exploit preconditions
- Attack surface: The publicly reachable
POST /api/auth/registerendpoint and social login flow - Required access: No authentication is required; the attacker needs a known victim email address
- Deployment conditions: Local registration must be enabled and at least one social provider must be configured
- Trigger point: The victim signs in through the configured social provider after a forged provider record has been persisted
- Why exploitation is possible: Registration accepts an unparsed request object, and the email-fallback path does not require a matching provider subject identifier
Why this happens
The registration flow permits client-controlled fields to influence persisted authentication data, an unsafe mass-assignment pattern associated with CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes. The social login email-fallback path then trusts a matching provider name without verifying the provider subject identifier. This authentication decision weakness maps to CWE-287: Improper Authentication, because the account association is accepted without sufficient proof that the social identity belongs to the existing user.
Potential impact
- An attacker may gain persistent access to a victim's account
- The attacker could read or modify data associated with the shared user record
- The victim's social OAuth session and the attacker's local-password session may become bound to the same account
- On a fresh deployment, the first-user administrator role could create additional impact if the relevant conditions are met
General mitigation guidance
Defensive patterns focus on limiting which registration fields clients can control and verifying identity bindings before accepting authentication.
- Allowlist permitted registration fields and assign sensitive authentication attributes server-side
- Require a verified provider subject identifier when associating a social login with an existing account
- Avoid relying on email or provider-name matches alone to establish account ownership
- Use explicit account-linking flows that require proof of control of both identities
- Keep registration and account-linking privileges narrowly scoped, and apply least privilege to user roles
How teams detect issues like this
- Review registration handlers for direct persistence of request bodies or dynamically assigned fields
- Inspect social login code for account matching based only on email or provider name, without a stable provider subject check
- Monitor for unexpected changes to provider identifiers, new local credentials on existing accounts, and unusual account-linking events
- Use static analysis and code review policies to flag mass assignment and authentication decisions that omit identity verification

