mcp-ssh-managerにSSH先で任意のコマンドを実行される脆弱性
Summary
mcp-ssh-managerのデータベース操作用の関数に、コマンドインジェクションの脆弱性が見つかりました。3.6.7より前のバージョンでは、細工した引数を渡すと、MCPサーバーが使うアカウントで設定済みのSSH接続先上の任意のコマンドが実行されるおそれがあります。読み取り専用モードでも、ssh_db_listを経由して影響を受けるため、3.6.7以降へ更新してください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
mcp-ssh-managerのデータベース操作用の関数に、コマンドインジェクションの脆弱性が見つかりました。3.6.7より前のバージョンでは、細工した引数を渡すと、MCPサーバーが使うアカウントで設定済みのSSH接続先上の任意のコマンドが実行されるおそれがあります。読み取り専用モードでも、ssh_db_listを経由して影響を受けるため、3.6.7以降へ更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| bvisiblemcp-ssh-manager | — | Not listed |
| npmmcp-ssh-manager |
< 3.6.7→ 3.6.7 |
3.6.7 |
Original description The description as published by the source.
Impact
Every ssh_db_* tool argument — database, table, collection, output/input file paths, and the user / host / port / password connection fields — arrives from tool-call parameters and was interpolated directly into a shell-evaluated command string in src/database-manager.js. A caller able to invoke a database tool with a crafted value ($(...), backticks, ; cmd, | cmd, && cmd, bare > file) achieves arbitrary command execution on the configured SSH target, under the account the MCP server uses.
The strongest path is ssh_db_list: it is documented and classified as read-only, so it remained allowed in the readonly and restricted per-server security modes while still reaching an injectable builder — bypassing the boundary those modes are meant to enforce. ssh_db_dump / ssh_db_import are blocked in readonly but remain injectable in the default unrestricted mode.
The earlier v3.6.5 fix (#44) only hardened ssh_db_query's query text via a single-quoted heredoc; the list/dump/import/restore builders — and the query builders' connection flags — were not covered.
Patches
Fixed in 3.6.7. A centralized shellQuote() (single-quote wrapping + '\'' escaping) now wraps every interpolated caller-controlled value across all 15 database builders. The MySQL list-tables database is passed as a shell-quoted positional argument instead of an interpolated USE SQL clause.
Workarounds
Upgrade to 3.6.7. If appl…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com