/

CVE-2026-54039

Severity:

HIGH RISK

(8.1)

Improper Authentication (CWE-287) in LibreChat OAuth

CVE-2026-54039

Awaiting Analysis

Vulnerability type

Category:

Improper Authentication

CWE:

CWE-287, CWE-915

Impact:

Account takeover and unauthorized access to victim data

Severity:

HIGH RISK

(8.1)

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

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/register endpoint 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

Sources

SourceLink
github.comgithub.com/LibreChat-AI/LibreChat/commit/b01d34abe29152e6e7f763089c0d9a6e647d0dba
github.comgithub.com/LibreChat-AI/LibreChat/pull/13307
github.comgithub.com/LibreChat-AI/LibreChat/releases/tag/v0.8.6
github.comgithub.com/LibreChat-AI/LibreChat/security/advisories/GHSA-wjpf-x42h-cv4m
librechat.ailibrechat.ai/changelog/v0.8.6

Frequently asked

questions

The described attack uses the registration and social login endpoints and does not require prior authentication, but it depends on the affected deployment settings and a later victim sign-in.

No account is required. The attacker needs a known victim email address, and local registration must be enabled with at least one social provider configured.

Accept only allowlisted registration fields, set authentication attributes on the server, and verify the provider's stable subject identifier before linking an identity to an existing account.

Treat client-supplied identity fields as untrusted, use explicit proof-based account-linking flows, and review registration and authentication code for mass assignment and incomplete identity checks.

Find out what's already
exploitable in your codebase.