Back to Blog
    Breach AnalysisMCP security · Shell policy bypass

    mcp-ssh-manager Restricted Mode Bypass: The Shell Saw a Command the Agent Policy Did Not

    8 min readAndeavour Research
    12✓45ATTACK CHAINBroken by AgentGuard
    Illustration: mcp-ssh-manager Restricted Mode Bypass: The Shell Saw a Command the Agent Policy Did Not
    4.3.3
    mcp-ssh-manager release that fixes the restricted-mode shell parsing bypass

    Key takeaways

    • →GHSA-86xm-rv3h-r4f2, published November 21, 2026, affects npm mcp-ssh-manager versions 3.8.6 through 4.3.2 when restricted mode is used.
    • →The policy parser and the actual shell interpreted comments, here-documents, ANSI-C quotes and some parenthesis forms differently. A command hidden from the allowlist could therefore run with the SSH user's privileges.
    • →Upgrade to 4.3.3 first. AgentGuard then adds an independent authorization boundary: immutable Principal identity, declared task, target and action are checked before an agent's high-impact operation is allowed.
    Attack chain, and where it breaks
    1. 1

      A malicious client or prompt-injected agent submits a crafted SSH command

    2. 2

      The restricted-mode parser sees only allowlisted command text

    3. 3

      The real shell interprets the same input differently

      AgentGuard independently challenges out-of-task, high-impact actions and binds them to the authenticated Principal; OS-level least privilege remains essential

    4. 4

      An additional command runs as the configured SSH user

    5. 5

      The remote host changes outside the operator's intended action

    Affected
    AI agents and MCP clients using mcp-ssh-manager restricted mode on versions 3.8.6–4.3.2
    When
    Advisory published November 21, 2026
    Impact
    A hidden shell command could execute with the configured SSH account's privileges despite the restricted-mode allowlist

    What the advisory actually says

    mcp-ssh-manager exposes remote SSH operations to MCP clients. Its restricted mode is meant to permit only commands matching an allowlist. In affected versions, splitShellCommand() did not always tokenize input the way the destination shell would. Security decisions were therefore made on a different command sequence from the one that executed.

    One documented example starts with an allowlist permitting only commands beginning with echo. An apostrophe inside a shell comment could make the policy parser consume a later line while the shell executed a touch command on that line. The maintainer also confirmed variants involving here-documents, ANSI-C quoting, complex parameter expansion and shell-dependent parentheses.

    This is not a finding against readonly mode, which is unaffected. Some variants depend on the target shell and invocation mode. The correct first response is to upgrade to 4.3.3 and restrict the SSH account itself, as the advisory recommends.

    Why an agent turns a parsing bug into an enterprise risk

    A human administrator may recognize an unusual shell construct. An agent sees a tool call that appears to satisfy its current objective. If untrusted content can steer that agent, the attacker no longer needs direct SSH access: the agent supplies the MCP call and the server supplies the credentials.

    The important boundary is not the tool name. It is the exact action that reaches the remote operating system, the identity that requested it and the business task it is meant to serve.

    • The MCP session and SSH credentials can both be valid
    • A tool-level allowlist does not prove what the shell will execute
    • Prompt injection can supply the malicious command indirectly
    • The SSH account's operating-system rights determine the blast radius

    How AgentGuard would contain the action

    AgentGuard does not replace the vendor fix and should not be described as a universal shell parser. Its role is to prevent one vulnerable framework decision from becoming the only control between an agent and a production system.

    First, every privileged request is tied to an immutable AI Principal and a declared task. An agent asked to inspect service logs does not silently acquire authority to create files, alter services or run arbitrary follow-on commands. Second, high-impact actions require an independent policy decision against the target, delegated scope and task context rather than inherited trust in the MCP server's restricted-mode label.

    Third, ambiguous or unverifiable action envelopes should fail closed at the governance layer, while the SSH account remains constrained by forced commands, a restricted shell or container isolation. That defense in depth matters because no second regular expression is a proven fix for shell parsing.

    What to do now

    Treat the vendor upgrade and privilege reduction as immediate actions; add agent governance around the remaining workflow.

    • Upgrade mcp-ssh-manager to 4.3.3 or later
    • Audit restricted servers on versions 3.8.6–4.3.2
    • Use forced commands or dedicated least-privilege SSH accounts
    • Alert on agents requesting shell actions outside their registered task

    The lesson

    An agent's valid session does not make every action legitimate. The vulnerability here is a disagreement between two interpreters, but the business impact comes from the agent's delegated power. AgentGuard adds an independent control plane around agents, their Principals, their tools and their declared tasks, so a framework decision is not the only decision that matters. The advisories themselves still need to be patched or the malicious package removed.

    Frequently asked questions

    Which mcp-ssh-manager versions are affected by GHSA-86xm-rv3h-r4f2?

    Versions 3.8.6 through 4.3.2 in restricted mode. Version 4.3.3 contains the fix. Readonly mode is not affected by this advisory.

    Was this mcp-ssh-manager bypass confirmed in a real customer attack?

    The GitHub advisory documents a vulnerability and reproduced parsing variants. It does not establish exploitation against a real customer, so this article does not claim an in-the-wild breach.

    How would AgentGuard help with a shell allowlist bypass?

    After patching, AgentGuard adds independent Principal, task, target and action authorization around the agent. It can challenge out-of-task privileged operations and preserve evidence, while OS-level restrictions limit what the SSH account can do.

    See AgentGuard on your own environment

    Zero integration. Live in days. We'll show you what your current stack is missing.