CVE-2026-54040
Undergoing Analysis Undergoing Analysis - In Progress
2FA Backup Code Regeneration in LibreChat

Publication date: 2026-06-25

Last updated on: 2026-06-25

Assigner: GitHub, Inc.

Description
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.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-06-25
Last Modified
2026-06-25
Generated
2026-06-26
AI Q&A
2026-06-25
EPSS Evaluated
N/A
NVD
EUVD
Affected Vendors & Products
Showing 3 associated CPEs
Vendor Product Version / Range
librechat librechat 0.8.4-rc1
danny_avila librechat to 0.8.4-rc1 (exc)
danny_avila librechat 0.8.4-rc1
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-306 The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
Attack-Flow Graph
AI Quick Actions
Instant insights powered by AI
Executive Summary

CVE-2026-54040 is a vulnerability in LibreChat versions 0.8.3 and earlier that allows an attacker to bypass two-factor authentication (2FA). The issue is in the /api/auth/2fa/backup/regenerate endpoint, which regenerates all 2FA backup codes without requiring verification of the one-time password (OTP) or existing backup codes.

An attacker who has a stolen session token can silently replace a victim's backup codes and then use those codes to bypass 2FA login or disable 2FA entirely. This happens because the function responsible for regenerating backup codes does not require any OTP re-verification and only requires a JWT token, which is insufficient security.

Additionally, the endpoint returns plaintext backup codes and their hashes, which leads to unnecessary information disclosure.

Impact Analysis

This vulnerability can allow an attacker with a stolen session token to bypass two-factor authentication protections silently.

The attacker can regenerate and replace the victim's 2FA backup codes without the victim's knowledge, enabling them to log in without the second factor or disable 2FA entirely.

This compromises the security of user accounts by weakening or removing the additional layer of authentication, increasing the risk of unauthorized access.

Furthermore, the exposure of plaintext backup codes and their hashes can lead to further information disclosure risks.

Detection Guidance

This vulnerability can be detected by monitoring for unauthorized or suspicious POST requests to the endpoint /api/auth/2fa/backup/regenerate on LibreChat servers running versions 0.8.3 and earlier.

Specifically, detection can focus on identifying requests that regenerate 2FA backup codes without proper TOTP or backup code verification, especially those accompanied by a valid session token but lacking OTP validation.

Network or system administrators can use web server logs or network traffic analysis tools to look for POST requests to this endpoint.

Example commands to detect such activity might include:

  • Using grep on server logs to find POST requests to the vulnerable endpoint: `grep "POST /api/auth/2fa/backup/regenerate" /var/log/nginx/access.log`
  • Using tcpdump or Wireshark to filter HTTP POST requests to the endpoint: `tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' | grep "/api/auth/2fa/backup/regenerate"`
  • Checking application logs for calls to the regenerateBackupCodes function or related 2FA backup code regeneration events without OTP verification.
Mitigation Strategies

The immediate mitigation step is to upgrade LibreChat to version 0.8.4-rc1 or later, where this vulnerability is fixed.

If upgrading immediately is not possible, restrict access to the /api/auth/2fa/backup/regenerate endpoint to trusted users only and monitor for suspicious activity.

Additionally, consider invalidating existing session tokens to prevent attackers from using stolen tokens to exploit this vulnerability.

Implement additional authentication checks such as requiring TOTP verification before allowing regeneration of 2FA backup codes.

Compliance Impact

The vulnerability in LibreChat allows an attacker with a stolen session token to bypass two-factor authentication (2FA) by regenerating backup codes without proper verification. This can lead to unauthorized access to user accounts and potential compromise of sensitive data.

Such unauthorized access and potential data compromise could negatively impact compliance with common standards and regulations like GDPR and HIPAA, which require strong access controls and protection of personal and sensitive information.

However, the provided information does not explicitly discuss the direct impact on compliance with these standards.

Chat Assistant
Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-54040. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70
EPSS Chart