/

CVE-2026-22252

Severity:

CRITICAL RISK

(9.1)

Improper Authorization in LibreChat MCP Stdio Transport

CVE-2026-22252

Analyzed

Vulnerability type

Category:

Improper Authorization

CWE:

CWE-285

Impact:

Remote Code Execution as Root (Post-Authentication)

Severity:

CRITICAL RISK

(9.1)

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 stdio transport previously allowed arbitrary shell commands to be executed as root inside the container by any authenticated user, without proper authorization checks.

When an attacker can issue a crafted API request to the MCP stdio transport, they can leverage this missing validation to run system-level commands with highest privileges in the container.

Affected context

The vulnerability occurs in LibreChat deployments that:

  • Enable the MCP stdio transport feature, and
  • Expose it via an API that can be reached by authenticated users (including potentially low-privileged users), and
  • Run the container processes with root privileges (the default in many containerized environments)

Under these circumstances, the MCP stdio transport treats incoming requests as trusted and forwards arbitrary commands to a shell, without enforcing granular authorization or command restrictions.

Exploit preconditions

  • Attack surface: LibreChat MCP stdio transport endpoint, accessible via LibreChat's API layer.
  • Required access: Valid authenticated access to LibreChat (even at a basic/user level), plus the ability to invoke the affected API route.
  • Trigger point: Sending a single crafted API request that specifies the command to be executed via the MCP stdio transport.
  • Why exploitation is possible: The transport path does not validate or constrain the commands being passed and does not apply proper authorization checks, while running under a root-privileged context inside the container.

Why this happens

This issue is a case of CWE-285: Improper Authorization, where the system fails to enforce sufficient permission checks before allowing security-sensitive operations.

In this design, any authenticated user is effectively granted a powerful "execute shell command" capability through the MCP stdio transport.

The implementation does not distinguish between low-privileged and administrative users, nor does it limit or sanitize commands, resulting in an unrestricted bridge from the application layer to the underlying shell running as root.

Potential impact

  • Remote execution of arbitrary shell commands as root within the LibreChat container
  • Full compromise of the LibreChat application environment and its data
  • Installation of backdoors or persistence mechanisms inside the container
  • Lateral movement attempts from the container to other services or infrastructure (depending on network and credential exposure)
  • Data exfiltration, modification, or destruction within the container's accessible storage
  • Potential pivot into broader cluster or host environments if additional misconfigurations exist

General mitigation guidance

Effective mitigation focuses on tightening authorization boundaries and minimizing the power of transport mechanisms that reach the shell:

  • Introduce explicit authorization checks for administrative or sensitive operations, ensuring that only designated roles can request command execution (if such functionality is needed at all).
  • Avoid exposing generic command-execution capabilities; replace them with narrowly scoped, parameterized operations that perform specific maintenance tasks without invoking an unrestricted shell.
  • Run application containers as non-root where possible, and use OS- and container-level confinement (such as seccomp, AppArmor, or SELinux) to limit damage if command execution is abused.
  • Apply the principle of least privilege to both application roles and underlying service accounts, reducing the potential blast radius.
  • Treat internal transport channels (like MCP stdio) as untrusted input boundaries: validate all requests, enforce strict schemas, and log attempts to perform sensitive actions.

How teams detect issues like this

Detection efforts can focus on both code-level review and runtime monitoring:

  • Static analysis or manual review to identify code paths where authenticated requests are translated directly into shell or process-execution calls without role checks or capability restrictions.
  • Search for usages of process-spawning APIs (e.g., exec, spawn, popen, or equivalent) within MCP / stdio transport modules and verify they are gated by robust authorization logic.
  • Implement audit logging for sensitive API routes, including who invoked them, what parameters were passed, and the resulting behavior, and periodically review these logs for anomalies.
  • Apply security policies in CI/CD (via linters or automated code review tools) to flag newly added or modified endpoints that can invoke system commands or privileged operations without explicit, role-based access control.

Sources

SourceLink
github.comgithub.com/danny-avila/LibreChat/commit/211b39f3113d4e6ecab84be0a83f4e9c9dea127f
github.comgithub.com/danny-avila/LibreChat/security/advisories/GHSA-cxhj-j78r-p88f

Frequently asked

questions

Yes, in typical deployments it can be exploited remotely by any user who can authenticate to the LibreChat instance and access the affected API endpoint, without needing direct shell or container access.

The attacker needs valid authenticated access to LibreChat but does not necessarily require elevated or administrative privileges. Once authenticated, a single crafted request to the MCP stdio transport path can trigger root-level command execution within the container.

The safest approach is to remove or strongly constrain generic command-execution features exposed via APIs, and ensure any remaining sensitive operations are strictly guarded by role-based authorization checks, input validation, and least-privilege process execution.

Incorporate security reviews into design and code phases, explicitly cataloging "sensitive operations" and requiring clear access-control policies for each. Use centralized authorization mechanisms, avoid ad hoc command bridges, enforce non-root container execution, and continuously test for broken access control using automated tools and targeted security tests.

Find out what's already
exploitable in your codebase.