CVE-2026-54040: LibreChat 2FA Backup Code Regeneration Flaw (MEDIUM)
LibreChat versions before 0.8.4-rc1 contain a flaw in their two-factor authentication (2FA) backup code regeneration process. An attacker who obtains a victim's session token can regenerate that user's 2FA backup codes without needing to verify the user's identity through any authentication method. The attacker can then use the newly generated codes to bypass 2FA entirely or disable it altogether. This is a silent attack—the victim receives no notification that their backup codes have been replaced.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.9 MEDIUM · CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:N
- Weaknesses (CWE)
- CWE-306
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-25 / 2026-06-29
NVD description (verbatim)
LibreChat is an enhanced ChatGPT clone that supports multiple AI providers. Prior to 0.8.4-rc1, the POST /api/auth/2fa/backup/regenerate endpoint regenerates all 2FA backup codes without requiring any TOTP token or existing backup code verification. An attacker with a stolen session token can silently replace a victim's backup codes and use them to bypass 2FA login or disable 2FA entirely. This vulnerability is fixed in 0.8.4-rc1.
2 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The POST /api/auth/2fa/backup/regenerate endpoint in LibreChat prior to version 0.8.4-rc1 fails to enforce proper authorization checks. The endpoint does not require submission of a valid TOTP token or verification of an existing backup code before allowing the regeneration of all backup codes. An attacker with a valid session token (obtained through phishing, credential compromise, or session hijacking) can invoke this endpoint and receive a new set of backup codes that supersede the legitimate user's codes. Because 2FA backup codes are typically single-use, high-entropy secrets meant to recover account access when the primary 2FA method is unavailable, their unverified regeneration creates a direct path to account takeover. The vulnerability maps to CWE-306 (Missing Authentication for Critical Function).
Business impact
For organizations or individuals using LibreChat, this vulnerability undermines the security guarantees of two-factor authentication. An attacker with session access can completely bypass the second factor without triggering any alerts, effectively reducing MFA protection to single-factor authentication. The silent nature of the attack means victims may remain unaware of the compromise until unauthorized access occurs. For LibreChat deployments in enterprise or healthcare environments where compliance (HIPAA, SOC 2, ISO 27001) requires functional MFA, this flaw represents a material control failure that could lead to audit findings or regulatory action.
Affected systems
LibreChat versions before 0.8.4-rc1 are affected. This includes stable releases and pre-release versions up to and including 0.8.3. The vulnerability requires an attacker to first obtain a valid session token, which means the attack assumes prior compromise of session credentials or tokens through separate means (e.g., credential theft, XSS, or device compromise).
Exploitability
The CVSS vector (AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:N) reflects that while the vulnerability is accessible over the network and requires low privileges (an authenticated session), it is not trivially exploitable. An attacker must already possess a valid session token, which raises the complexity. However, once that token is in hand, exploitation is automatic and requires no user interaction. The attack is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, but the silent nature and the critical role of backup codes in 2FA recovery make this a concern for active monitoring.
Remediation
Upgrade LibreChat to version 0.8.4-rc1 or later, which implements proper authorization checks on the 2FA backup code regeneration endpoint. Verify against the vendor advisory that the patched version includes TOTP or backup code verification before regenerating codes. Organizations should also review session management practices (enforce short session timeouts, use secure token storage) and monitor authentication logs for suspicious regeneration patterns.
Patch guidance
Apply the update to LibreChat 0.8.4-rc1 or later as soon as testing permits. Since this is marked as an rc (release candidate), confirm with the vendor timeline for a stable 0.8.4 release. If your deployment is critical and you cannot immediately upgrade to rc, implement compensating controls: monitor for unexpected 2FA backup code regeneration events, enforce strict session timeout policies (e.g., 30-minute inactivity timeout), and consider requiring re-authentication (TOTP) before any sensitive settings changes.
Detection guidance
Monitor application logs for unusual patterns in the POST /api/auth/2fa/backup/regenerate endpoint usage. Establish a baseline for backup code regeneration frequency per user (typically rare) and alert on anomalies. Correlate regeneration events with geographic or IP-based session changes. Implement audit logging that records the source IP, timestamp, and user identity for all 2FA configuration changes. Review access logs for sessions that authenticate from unusual locations or at odd hours and then trigger 2FA modifications.
Why prioritize this
Although rated MEDIUM severity, this vulnerability should be prioritized for rapid patching because it directly defeats multi-factor authentication—a critical compensating control for many organizations. The silent attack surface and the low friction of exploitation (once session access is obtained) mean that organizations relying on LibreChat for sensitive workloads should treat this as a near-critical issue. Prioritize patching if LibreChat instances handle regulated data or are exposed to high-value user accounts.
Risk score, explained
The CVSS 5.9 MEDIUM rating reflects the prerequisite of already-compromised session credentials, which limits the immediate threat vector. However, the impact is severe: confidentiality is slightly affected (user can access account), but integrity is highly affected (attacker can disable 2FA and take over the account). The attack avoids causing denial of service, hence availability is unaffected. The rating appropriately penalizes exploitability (AC:H due to the need for prior session compromise) while acknowledging the high integrity impact of backup code manipulation.
Frequently asked questions
If an attacker regenerates my backup codes, can I still detect it?
Not through the application itself in versions prior to 0.8.4-rc1, because the endpoint does not require verification and does not notify the user. However, if your LibreChat instance logs 2FA changes to a SIEM or audit system, your security team may detect the regeneration event through log analysis. You should always monitor for unexpected 2FA modifications.
Do I need a valid 2FA backup code to exploit this vulnerability?
No. An attacker with only a valid session token can regenerate backup codes without possessing any existing codes. This is the core of the vulnerability—the endpoint assumes the session token itself is sufficient proof of identity, which is insufficient for such a sensitive operation.
Is there a workaround if I cannot update to 0.8.4-rc1 immediately?
There is no perfect workaround, but you can reduce risk by enforcing very short session lifetimes (e.g., 30 minutes of inactivity), requiring re-authentication for account settings changes, and enabling detailed audit logging of all 2FA operations. Additionally, monitor for suspicious backup code regeneration events and alert on them immediately.
Why is this a MEDIUM severity rather than HIGH or CRITICAL?
The CVSS metric accounts for the fact that an attacker must first compromise a session token. However, in environments where sessions are frequently compromised (via phishing, malware, or XSS), or where users reuse sessions across untrusted networks, the practical risk is higher. Organizations handling sensitive data should treat this as higher priority than the base score suggests.
This analysis is provided for informational purposes and reflects the vulnerability description and CVSS vector as published. Organizations should verify patch version availability and compatibility with their deployed LibreChat configuration through official vendor advisories before applying updates. The assessment assumes standard LibreChat authentication and 2FA configurations; custom deployments or third-party integrations may exhibit different risk profiles. No exploit code or proof-of-concept is provided. Always consult your vendor documentation and conduct testing in a non-production environment before deploying security patches to production systems. Source: NVD (public-domain), retrieved 2026-08-03. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-54036MEDIUMLibreChat 2FA Bypass via Unprotected Endpoint—Patch to 0.8.4-rc1
- CVE-2026-10283MEDIUMBottelet DaybydayCRM Authentication Bypass in Settings Handler
- CVE-2026-11238MEDIUMChrome DevTools Memory Disclosure via Malicious Extension
- CVE-2026-11848MEDIUMiRM-IEI Remote Management Missing Authentication Vulnerability
- CVE-2026-25599MEDIUMOrca Heat Pump Unauthenticated HTTP and Stored XSS Vulnerability
- CVE-2026-2675MEDIUMRTI Connext Professional Data Source Spoofing Vulnerability
- CVE-2026-41047MEDIUMqSnapper Snapshot Diff Authentication Bypass (CVSS 5.5)
- CVE-2026-45610MEDIUMWWBN AVideo 2FA CSRF Vulnerability – Cross-Site Account Takeover Risk