CVE-2026-31942: LibreChat: IDOR enables cross-user API key hijacking
HIGHLibreChat versions up to 0.7.6 contain an Insecure Direct Object Reference flaw in the API key management endpoint that allows any authenticated user to overwrite another user's AI provider credentials (OpenAI, Anthropic, Azure) by injecting a target userId into the PUT /api/keys request body — a consequence of JavaScript object spread ordering that sets the user ID before spreading untrusted input. In multi-tenant or enterprise self-hosted deployments, this means a low-privilege attacker can silently redirect a victim's LLM conversations through attacker-controlled API keys, enabling passive monitoring of all prompt-response pairs via the attacker's provider account logs. The exploit requires no specialized skill — only a valid account and a modified HTTP request — making it realistic in any shared LibreChat environment, particularly organizations using it for sensitive internal workflows such as legal, HR, or security operations. Upgrade to version 0.8.3-rc1 immediately; if patching is delayed, block the PUT /api/keys endpoint at the reverse proxy for cross-user requests and audit API key change logs for userId values that differ from the authenticated session principal.
What is the risk?
High risk for any multi-user LibreChat deployment. CVSS 7.1 reflects low attack complexity and minimal privilege requirements combined with high integrity impact. No public exploit code or CISA KEV listing as of publication, but the vulnerability is trivially reproducible using standard HTTP interception tools — no AI or security expertise required. Organizations running shared or enterprise LibreChat instances face real credential compromise risk. The confidentiality of LLM API interactions is directly threatened because attacker-substituted keys grant the attacker visibility into all victim conversation traffic at the provider layer.
Attack Kill Chain
Severity & Risk
Attack Surface
What should I do?
5 steps-
PATCH
Upgrade LibreChat to version 0.8.3-rc1 or later — this is the only complete fix.
-
WORKAROUND (if patching is delayed): At the reverse proxy or WAF layer, enforce that the userId in PUT /api/keys request bodies matches the authenticated session user ID; reject or strip divergent values.
-
DETECT
Audit application access logs for PUT /api/keys requests where the body userId field differs from the session-authenticated user; any such request represents a likely exploitation attempt.
-
INVESTIGATE
Review API key change history across all users for unauthorized modifications, particularly changes made shortly after an unrecognized login.
-
ROTATE
If compromise is suspected, immediately rotate all AI provider API keys (OpenAI, Anthropic, Azure, etc.) associated with potentially affected users and revoke any attacker-substituted keys via the respective provider dashboards.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-31942?
LibreChat versions up to 0.7.6 contain an Insecure Direct Object Reference flaw in the API key management endpoint that allows any authenticated user to overwrite another user's AI provider credentials (OpenAI, Anthropic, Azure) by injecting a target userId into the PUT /api/keys request body — a consequence of JavaScript object spread ordering that sets the user ID before spreading untrusted input. In multi-tenant or enterprise self-hosted deployments, this means a low-privilege attacker can silently redirect a victim's LLM conversations through attacker-controlled API keys, enabling passive monitoring of all prompt-response pairs via the attacker's provider account logs. The exploit requires no specialized skill — only a valid account and a modified HTTP request — making it realistic in any shared LibreChat environment, particularly organizations using it for sensitive internal workflows such as legal, HR, or security operations. Upgrade to version 0.8.3-rc1 immediately; if patching is delayed, block the PUT /api/keys endpoint at the reverse proxy for cross-user requests and audit API key change logs for userId values that differ from the authenticated session principal.
Is CVE-2026-31942 actively exploited?
No confirmed active exploitation of CVE-2026-31942 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-31942?
1. PATCH: Upgrade LibreChat to version 0.8.3-rc1 or later — this is the only complete fix. 2. WORKAROUND (if patching is delayed): At the reverse proxy or WAF layer, enforce that the userId in PUT /api/keys request bodies matches the authenticated session user ID; reject or strip divergent values. 3. DETECT: Audit application access logs for PUT /api/keys requests where the body userId field differs from the session-authenticated user; any such request represents a likely exploitation attempt. 4. INVESTIGATE: Review API key change history across all users for unauthorized modifications, particularly changes made shortly after an unrecognized login. 5. ROTATE: If compromise is suspected, immediately rotate all AI provider API keys (OpenAI, Anthropic, Azure, etc.) associated with potentially affected users and revoke any attacker-substituted keys via the respective provider dashboards.
What systems are affected by CVE-2026-31942?
This vulnerability affects the following AI/ML architecture patterns: multi-tenant LLM chat platforms, self-hosted AI assistant deployments, enterprise AI gateway and API broker deployments, multi-provider AI API integrations.
What is the CVSS score for CVE-2026-31942?
CVE-2026-31942 has a CVSS v3.1 base score of 7.1 (HIGH).
AI Security Impact
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0012 Valid Accounts AML.T0040 AI Model Inference API Access AML.T0049 Exploit Public-Facing Application AML.T0091.000 Application Access Token AML.T0106 Exploitation for Credential Access Compliance Controls Affected
Technical Details
Original Advisory
LibreChat is an enhanced ChatGPT clone that supports multiple AI providers. In versions up to and including 0.7.6, an Insecure Direct Object Reference (IDOR) vulnerability exists in the API keys management endpoint (PUT /api/keys). Due to the use of the JavaScript object spread operator after setting the authenticated user's ID, any authenticated user can inject a userId parameter in the request body to overwrite any other user's API keys (e.g., OpenAI, Anthropic, Azure). This allows an attacker to replace a victim's API key configuration, potentially routing the victim's conversations through attacker-controlled keys or denying service by providing invalid keys. This is patched in version 0.8.3-rc1.
Exploitation Scenario
An attacker registers a free or compromised low-privilege account on a shared enterprise LibreChat instance. Using a proxy such as Burp Suite, they intercept the PUT /api/keys request made from their own session, observing the JSON body structure including their own userId. They then enumerate or infer a target victim's userId — potentially via API responses, profile pages, or shared conversation references — and craft a modified PUT /api/keys request substituting the victim's userId while providing their own attacker-controlled OpenAI or Anthropic API key. Because LibreChat spreads the authenticated user ID before applying the request body, the attacker-supplied userId overwrites it. From this point, every LLM call the victim makes in LibreChat is billed to and logged under the attacker's API key account, giving the attacker full visibility into victim conversation content through the provider's usage dashboard or API logs — all without ever touching the victim's LibreChat session.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L Timeline
Related Vulnerabilities
CVE-2026-21858 10.0 n8n: Input Validation flaw enables exploitation
Same attack type: Data Extraction CVE-2025-53767 10.0 Azure OpenAI: SSRF EoP, no auth required (CVSS 10)
Same attack type: Data Extraction CVE-2023-3765 10.0 MLflow: path traversal allows arbitrary file read
Same attack type: Data Extraction CVE-2025-2828 10.0 LangChain RequestsToolkit: SSRF exposes cloud metadata
Same attack type: Data Extraction GHSA-vvpj-8cmc-gx39 10.0 picklescan: security flaw enables exploitation
Same attack type: Auth Bypass