/

CVE-2026-45018

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in Chainlit MCP Endpoint

CVE-2026-45018

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

CRITICAL RISK

(9.8)

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

Chainlit deployments that enable the MCP feature may expose an unauthenticated endpoint that accepts attacker-controlled stdio command data. An attacker can abuse supported command-line behavior to execute arbitrary shell commands with the privileges of the Chainlit process.

Affected context

The issue occurs in Chainlit deployments where features.mcp.enabled is set to true and the MCP POST endpoint is reachable. It is especially risky when stdio transport is enabled, command restrictions are absent or incomplete, and the endpoint is exposed without an authentication or authorization boundary.

Exploit preconditions

  • Attack surface: The unauthenticated POST /mcp endpoint
  • Required access: Network access to the exposed Chainlit service; no application authentication may be required
  • Trigger point: Processing a user-controlled fullCommand for MCP stdio transport
  • Why exploitation is possible: Validation checks the executable name but does not adequately constrain arguments, while an unset executable allowlist may permit any executable

Why this happens

The vulnerability results from incomplete validation of a command constructed from user-controlled input. The implementation validates only part of the command and forwards unchecked arguments to the stdio server configuration. This permits shell-capable command-line options, such as those supported by npx, to alter execution behavior and run attacker-controlled commands. The pattern maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Potential impact

  • An attacker may execute arbitrary operating-system commands
  • The Chainlit process and its accessible application data could be compromised
  • Secrets, tokens, or configuration data may be exposed
  • The vulnerable service could be used for lateral movement or persistence
  • Connected conversational AI services and integrations could be manipulated

General mitigation guidance

Mitigation generally focuses on removing unauthenticated command-execution paths and treating all MCP command data as untrusted.

Common defensive patterns include:

  • Require authentication and authorization before exposing MCP endpoints
  • Prefer fixed, predefined server commands over user-supplied command strings
  • Avoid shell-capable command interpreters and argument forms
  • Validate executable paths and every argument against a strict schema and allowlist
  • Treat an unset allowlist as deny-by-default rather than permitting all executables
  • Run Chainlit with a dedicated, minimally privileged identity and restricted filesystem access
  • Isolate MCP workers from sensitive networks, credentials, and host resources

How teams detect issues like this

Detection can combine application review, runtime monitoring, and policy enforcement:

  • Search source code for subprocess or stdio server creation that receives request-derived command values
  • Flag validation routines that check executable names but not arguments or shell metacharacters
  • Review configurations for enabled MCP features, exposed endpoints, missing authentication, and unset executable allowlists
  • Monitor process creation from Chainlit workers, including unexpected interpreters, package runners, network utilities, and child processes
  • Enforce CI policies that reject shell execution from request-controlled data
  • Use static analysis and automated code review tools to identify command construction and incomplete allowlist validation

Sources

SourceLink
github.comgithub.com/Chainlit/chainlit/blob/2.12.0/docs/security-advisory-2026-mcp.md#spl-2026-001--command-injection-via-mcp-stdio
github.comgithub.com/Chainlit/chainlit/commit/0565fd0eccb915fce159929598b053ed79f6e0c9
github.comgithub.com/Chainlit/chainlit/releases/tag/2.12.0
github.comgithub.com/Chainlit/chainlit/security/advisories/GHSA-w3fx-mc44-mf6j

Frequently asked

questions

Yes, when the MCP endpoint is network-reachable, enabled, and lacks an effective authentication boundary. The attacker generally does not need local access to the host.

Not necessarily. The described deployment condition exposes the endpoint without authentication, although external network controls may still limit reachability.

Do not accept arbitrary command strings from requests. Use authenticated MCP access, fixed command definitions, strict executable and argument validation, and deny-by-default configuration.

Treat command and argument data as untrusted, prohibit shell-capable execution paths, require security review for process-spawning code, and run application workers with minimal privileges.

Find out what's already
exploitable in your codebase.