CVE-2026-54038 in LibreChat
Summary
by MITRE • 11/20/2026
LibreChat is an enhanced ChatGPT clone that supports multiple AI providers. Prior to 0.8.9, GET /api/permissions/search-principals passes the q parameter to JavaScript RegExp construction and MongoDB regex queries in packages/data-schemas/src/methods/userGroup.ts findGroupsByNamePattern and searchPrincipals without escaping metacharacters. An authenticated user with people-picker permission can submit a catastrophic-backtracking pattern that blocks the Node.js event loop and makes the service unresponsive to concurrent users; invalid patterns can also produce server errors. This issue is fixed in version 0.8.9.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/20/2026
LibreChat, an enhanced ChatGPT clone supporting multiple AI providers, contains a critical vulnerability in its user group management functionality prior to version 0.8.9. The specific flaw resides within the GET /api/permissions/search-principals endpoint, which is designed to search for principals based on provided query parameters. Specifically, the q parameter is passed directly into JavaScript RegExp construction and subsequently used in MongoDB regex queries via the findGroupsByNamePattern and searchPrincipals methods located in packages/data-schemas/src/methods/userGroup.ts. The core technical deficiency is the failure to escape metacharacters within this input before it is processed by regular expression engines. This lack of sanitization allows an attacker who has authenticated access and possesses people-picker permissions to inject specially crafted malicious patterns into the query string.
The operational impact of this vulnerability manifests primarily as a catastrophic backtracking issue, which falls under CWE-134: Use of Externally-Controlled Input to Select Classes or Code (Arbitrary Code Execution) in the context of resource consumption, and more specifically aligns with CWE-787: Out-of-bounds Write if it leads to memory corruption, though here it is primarily a Denial of Service vector. By submitting a regex pattern designed to cause exponential time complexity during matching, such as those involving nested quantifiers or ambiguous alternations, an attacker can force the Node.js event loop to block indefinitely while attempting to resolve the match. This effectively renders the service unresponsive to concurrent legitimate users, creating a Denial of Service condition that disrupts availability for all connected clients. Additionally, invalid patterns submitted by attackers may trigger unexpected server errors, further degrading system stability and potentially exposing internal stack traces or error messages that could aid in further reconnaissance.
This vulnerability is classified under the MITRE ATT&CK framework as T1499: Endpoint Denial of Service, specifically utilizing resource exhaustion techniques via application layer attacks. The attack vector requires authentication, placing it within the scope of authenticated user exploitation rather than remote unauthenticated access. However, given that many enterprise deployments may have broad permission sets or internal users with varying levels of trust, the risk remains significant for organizations relying on LibreChat for critical operations. The vulnerability highlights a common pitfall in web application development where input validation is insufficiently rigorous when dealing with complex data types like regular expressions used in database queries and server-side scripting engines.
To mitigate this issue, administrators must upgrade to version 0.8.9 or later of LibreChat, which includes the necessary fixes for escaping metacharacters and validating regex patterns before execution. In environments where immediate upgrading is not feasible, implementing a Web Application Firewall with rules capable of detecting anomalous regular expression complexity in query parameters can provide temporary protection. Furthermore, developers should enforce strict input validation that rejects any non-alphanumeric characters or limits the length and complexity of inputs destined for regex construction. It is also advisable to implement timeout mechanisms on database queries and JavaScript execution contexts to prevent indefinite blocking of the event loop, thereby limiting the blast radius of such attacks even if they are attempted.