# CVE-2026-31942: LibreChat IDOR in API keys management endpoint

Source: https://junglewise.ai/threats/cve-2026-31942-librechat-idor-in-api-keys-management-endpoint  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-06-02. Updated: 2026-06-02  
License: CC BY 4.0 with a link back

CVE-2026-31942 · Severity: high · CVSS 7.1 · Published 2026-06-02

LibreChat, an open-source interface for multiple AI providers, contains a security flaw that allows any logged-in user to modify the API keys of other users. By overwriting these keys, an attacker can disrupt a victim's service or potentially redirect their AI conversations through an account controlled by the attacker. This could lead to the exposure of sensitive conversation data to the attacker via their AI provider's logs.

Technologies: [LibreChat](https://junglewise.ai/threats/technologies/librechat). Vendors: [LibreChat](https://junglewise.ai/threats/vendors/librechat).

## Quick answers

**Is CVE-2026-31942 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-31942 being exploited in the wild.

**How severe is CVE-2026-31942?** High severity, with a CVSS score of 7.1, published 2 June 2026.

**Which products and versions are affected?** LibreChat <= 0.7.6.

**Is there a fix for CVE-2026-31942?** A patch was published on 2026-06-02: Patched in 0.8.3-rc1 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-31942 attacked?** It is attacked over the network, in a network appliance.

**Am I affected by CVE-2026-31942?** Check whether you run LibreChat at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

An Insecure Direct Object Reference (IDOR) exists in the 'PUT /api/keys' endpoint due to improper use of the JavaScript object spread operator. In 'api/server/routes/keys.js', the application sets the 'userId' from the authenticated session but then applies '...req.body', which allows an attacker to provide a 'userId' in the request body that overrides the legitimate one. An authenticated attacker can exploit this to call 'updateUserKey' for any arbitrary user ID, replacing their configured API keys (e.g., OpenAI, Anthropic) with attacker-supplied values. This allows for service disruption or conversation interception via the attacker's own AI provider accounts. The issue is fixed in version 0.8.3-rc1 by explicitly destructuring only allowed fields from the request body.

## Affected products

- LibreChat LibreChat <= 0.7.6

## Timeline

- 2026-06-02: disclosed
- 2026-06-02: advisory
- 2026-06-02: patched: Patched in 0.8.3-rc1

## References

- [https://github.com/danny-avila/LibreChat/security/advisories/GHSA-5jcj-rh68-cgj7](https://github.com/danny-avila/LibreChat/security/advisories/GHSA-5jcj-rh68-cgj7)

## Related threats

- [LibreChat 2FA bypass via unauthenticated backup code regeneration](https://junglewise.ai/threats/cve-2026-54040-librechat-2fa-bypass-via-unauthenticated-backup-code-regeneration)
- [LibreChat resource exhaustion via missing rate limiting in duplicate endpoint](https://junglewise.ai/threats/cve-2026-54037-librechat-resource-exhaustion-via-missing-rate-limiting-in)
- [LibreChat SSRF via custom endpoint baseURL](https://junglewise.ai/threats/cve-2026-54033-librechat-ssrf-via-custom-endpoint-baseurl)
- [LibreChat token theft via missing OAuth resource validation in MCP](https://junglewise.ai/threats/cve-2026-54030-librechat-token-theft-via-missing-oauth-resource-validation-in)
- [danny-avila LibreChat IDOR in message deletion endpoint](https://junglewise.ai/threats/cve-2026-54029-danny-avila-librechat-idor-in-message-deletion-endpoint)
