Repository navigation
fix(security): block STDIO command injection — RCE at connection creation - #4023
Merged
Merged
Conversation
STDIO MCP connections spawn arbitrary commands as child processes via StdioClientTransport. The proxy-time path (outbound/index.ts) had a localMode guard, but the creation-time path (create.ts → fetch-tools.ts → StdioClientTransport) did not — allowing any authenticated user to execute arbitrary OS commands on the server by creating a STDIO connection with a malicious command/args in connection_headers. Three guards added: 1. create.ts: reject STDIO connection_type when not in local mode 2. update.ts: reject STDIO connection_type when not in local mode 3. fetch-tools.ts: defense-in-depth localMode check in fetchToolsFromStdioMCP before spawning Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
decocms Bot
pushed a commit
that referenced
this pull request
Jun 19, 2026
PR: #4023 fix(security): block STDIO command injection — RCE at connection creation Bump type: patch - decocms (apps/mesh/package.json): 3.36.0 -> 3.36.1 Deploy-Scope: server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Critical: OS command injection via STDIO MCP connections. Any authenticated user could execute arbitrary commands on the server by creating a STDIO connection with a malicious
command/argsinconnection_headers.The proxy-time path (
outbound/index.ts:54-60) correctly blocks STDIO spawns outside local mode. But the creation-time path (create.ts→fetchToolsFromMCP()→fetchToolsFromStdioMCP()→new StdioClientTransport({command, args})) had nolocalModeguard — user-supplied commands were spawned immediately as child processes, with errors silenced by.catch(() => null).Attack vector
POST /api/:org/tools/COLLECTION_CONNECTIONS_CREATE { "data": { "connection_type": "STDIO", "connection_headers": { "command": "bash", "args": ["-c", "id > /tmp/rce_proof.txt"] } } } # → 200 OK, command already executed on serverFix — three guards added
apps/mesh/src/tools/connection/create.tsconnection_typewhen not in local mode (primary)apps/mesh/src/tools/connection/update.tsapps/mesh/src/tools/connection/fetch-tools.tslocalModecheck insidefetchToolsFromStdioMCPbefore anyStdioClientTransportspawnTest plan
bun run check— passesbun run fmt— passesbun run lint— passes (0 errors)localMode=false--local-mode)localMode=false🤖 Generated with Claude Code
Summary by cubic
Fixes a critical RCE by blocking STDIO MCP connection create/update outside local mode and adding a defense-in-depth check in the fetch path. Prevents arbitrary command execution on the server; STDIO now works only in local mode.
Bug Fixes
STDIOconnection create/update whenlocalModeis false.localModeguard infetchToolsFromStdioMCPto prevent any spawn in non-local environments.Migration
SSEorHTTPconnections.Written for commit d921220. Summary will update on new commits.