/

CVE-2026-32625

Severity:

CRITICAL RISK

(9.6)

Environment Variable Exposure via URL Interpolation (CWE-200) in LibreChat MCP Server Integration

CVE-2026-32625

Analyzed

Vulnerability type

Category:

Information Exposure

CWE:

CWE-200

Impact:

Exposure of Cryptographic Secrets and Database Credentials

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

LibreChat's MCP server integration up to version 0.8.3 interpolates ${VAR} placeholders in user-supplied MCP server URLs against the server's process.env during Zod schema validation.

Any authenticated user can craft a malicious MCP server configuration that causes the LibreChat server to leak sensitive environment variables (such as CREDS_KEY, CREDS_IV, JWT_SECRET, and MONGO_URI) to an attacker-controlled endpoint, enabling full compromise of cryptographic keys and database credentials without admin privileges.

Affected context

This vulnerability affects LibreChat deployments that:

  • Enable the Model Context Protocol (MCP) server integration, and
  • Allow authenticated (non-admin) users to configure or register MCP servers, and
  • Run with sensitive secrets stored in environment variables (e.g., encryption keys, JWT secrets, database URIs).

The issue occurs when user-controlled MCP server URLs are processed and validated, and the server's environment variables are interpolated directly into those URLs before any isolation or redaction is applied.

Exploit preconditions

  • Attack surface: Application's HTTP interface for authenticated users (e.g., MCP server configuration UI or API).
  • Required access: Any valid user account; administrative privileges are not required.
  • Trigger point: Submission or update of an MCP server configuration whose URL contains ${VAR_NAME} placeholders referencing environment variables.
  • Why exploitation is possible: The MCP integration resolves ${VAR} placeholders against the server's process.env as part of Zod schema validation, then performs an outbound request to the attacker-controlled server, embedding the expanded secrets directly into the request URL or parameters.

Why this happens

The core issue is treating sensitive server-side configuration (environment variables) as a string substitution source for user-controlled data, without segregation of trust boundaries or redaction.

During validation of user-supplied MCP server URLs, the application interpolates ${VAR} placeholders using process.env, effectively allowing untrusted users to specify arbitrary environment variable names that will be expanded. This behavior maps to CWE-200: Information Exposure, where internal secrets are unintentionally disclosed through an externally observable channel. The problem is conceptual: mixing server secrets into user-controlled URL templates and then initiating outbound requests to attacker endpoints, leaking secrets in the process.

Potential impact

  • Attackers can obtain cryptographic keys (e.g., CREDS_KEY, CREDS_IV) and decrypt stored credentials or sensitive data.
  • Attackers can steal JWT_SECRET and forge valid authentication tokens, impersonating any user or escalating privileges.
  • Attackers can exfiltrate MONGO_URI and other database credentials, enabling direct database access and full data compromise.
  • Attackers can potentially pivot to further infrastructure compromise by abusing leaked secrets in connected services.
  • Long-term integrity and confidentiality of all data in the LibreChat instance and associated systems may be lost.

General mitigation guidance

Effective mitigation focuses on enforcing a strict separation between user-controlled configuration and server-side secrets, and removing any automatic secret interpolation in user-provided URLs.

Recommended design patterns include:

  • Remove secret expansion in untrusted input: Do not resolve ${VAR} placeholders from process.env in any user-supplied string, especially URLs or endpoints.
  • Use explicit, controlled configuration: If templating is needed, restrict variable expansion to a predefined, non-sensitive set of values (e.g., fixed base URLs), not arbitrary environment variables.
  • Isolate secret handling: Keep sensitive environment variables and key material confined to internal application logic and secure configuration layers; never surface them in validation, logging, or network calls derived from user inputs.
  • Apply least privilege and compartmentalization: Run the application with the minimum set of secrets and permissions necessary; separate responsibilities (e.g., use dedicated service accounts or separate configs for outbound connections).
  • Harden MCP configuration flows: Treat connector definitions, plugin URLs, and similar extension points as high-risk inputs, applying additional scrutiny and security reviews to any dynamic behavior.

How teams detect issues like this

Detection should focus on identifying both the vulnerable pattern in code and any indicators of secret exfiltration at runtime.

Possible strategies include:

  • Static analysis and code review:
  • Search for patterns where environment variables (e.g., process.env.*) are concatenated or interpolated into values derived from user input, especially URLs and request targets.
  • Flag validation logic that performs string replacement of ${VAR}-style placeholders without strict whitelisting.
  • Look for outbound HTTP clients that are fed user-controlled URLs after environment-based substitution.
  • Configuration and policy checks:
  • Enforce policies prohibiting expansion of server secrets into user-editable templates or configuration fields.
  • Use secure coding guidelines and checklists for integration points like MCP servers, plugins, and webhooks.
  • Runtime monitoring:
  • Monitor outbound traffic for suspicious patterns, such as secrets appearing in query strings, headers, or path segments.
  • Enable logging and anomaly detection on egress traffic to detect high-entropy values or known secret patterns being sent to untrusted domains.
  • Automated tooling:
  • Employ secret-scanning tools that inspect logs and HTTP traces for leaked secrets.
  • Integrate static analysis tools in CI/CD to detect environment-variable usage in conjunction with user-controlled data.

Sources

SourceLink
github.comgithub.com/danny-avila/LibreChat/security/advisories/GHSA-4pcc-j6m6-wcwx

Frequently asked

questions

Any authenticated user with access to MCP server configuration can exploit this issue; they do not need administrative privileges. As long as they can submit or modify an MCP server URL, they can attempt to exfiltrate environment variables.

The attacker needs a valid account on the affected LibreChat instance but does not require elevated roles. The attack is carried out entirely through the standard MCP configuration interface or API.

The safest fix is to remove all environment-variable interpolation from user-supplied MCP server URLs and similar configuration fields. If templating is required, restrict it to a controlled set of non-sensitive placeholders and keep secret handling entirely separate from user-controlled data paths.

Apply a strict trust-boundary model: never mix server-side secrets into values derived from user input, avoid generic ${VAR} expansion in user-controlled fields, and conduct security reviews for integration mechanisms that involve callbacks or external endpoints. Complement this with static analysis rules and code review practices that flag any use of secret values in user-visible or network-facing contexts.

Find out what's already
exploitable in your codebase.