SW-MCP-013: Tool takes a command line to run as an argument
Last updated 26 November 2026
| Fact | Value |
|---|---|
| Severity | Medium. The finding is medium under the default and the low-noise preset, because the measured precision on its whole frame is 66.7%. The strict preset raises it to high. Presets lists every rule's severity under each preset. |
| Checks | MCP server |
| Malicious indicator | No |
| OWASP Agentic Top 10 | ASI05 |
| OWASP MCP Top 10 | MCP05 |
| OWASP Agentic Skills Top 10 | None mapped |
| MITRE ATLAS | AML.T0053 |
| NIST SP 800-53 | SI-10 (provisional mapping to SP 800-53 base controls) |
| EU AI Act | Evidence toward EU AI Act article 15 |
| First shipped in | Scanner 1.25.0 |
What it detects
The rule judges one recorded probe of a server, one tool at a time. A tool is flagged when its input schema has a parameter of the type string that is named command, cmd, commandLine, shell_command, bash_command, powershell_command, shell or bash, that has no enum or const, and when the tool's name or description says that it runs or executes something. One finding is raised per tool, on the location tool:NAME. A claim by the server that the tool is sandboxed or read-only never silences the finding, because the claim is text the server wrote about itself and the rule has no way to check it.
A tool whose schema the prober dropped for size is not judged, and the probe still names tools in lists_cut, so the scan reports that the list was read only in part.
The rule is quiet on a parameter with an enum or a const, on a parameter that is not a string, on a tool whose name and description do not say that it runs or executes anything, on a tool without an input schema, and on parameters with other names such as commands or command_id. It cannot see injection through an argument of a tool that runs a fixed program, whether a server filters or sandboxes the command it is given, or servers that run as local processes, because the probe reaches remote servers only. It does not read code interpreters whose parameter is code either.
How the rule is measured: on its whole frame, 210,994 tools listed by public remote MCP servers (30,402 hosts). The frozen rule flagged 54 tools from 47 servers, fewer than the 60 a held-out split needs, so every flagged tool was labelled, no part was held out, the rule was not tuned on them and the set was scored once. Precision is 66.7% (95% interval 53.4% to 77.8%; 36 of 54 flagged tools were the kind the rule describes) and recall is 13.1% (7.2% to 20.8%), measured on 26 November 2026, so the severity is medium. Two language models labelled the tools and a third adjudicated blind, and a person audited a 150-item sample. The labellers are models of one family, planted examples may be easier than real ones, and the sets are not published because they hold third-party text. The scanner's benchmarks README says how a set is made and scored.
Why it matters
A tool that takes a command line hands the model a way to run whatever it writes. If an injected instruction in a web page, a document or another tool's answer reaches the model, the model can put it in that argument, and the server runs it with the server's own rights. Naming the operations a tool may perform keeps what an agent can do to a short list that a person can review. The scanner maps this rule to OWASP MCP05, Command Injection & Execution, and ASI05, Unexpected Code Execution (RCE), and to NIST SP 800-53 control SI-10, Information Input Validation.
Example
This recorded probe lists one tool that takes a free-text command and says in its description that it runs it, so the rule raises one finding on that tool:
probe.json
{
"endpoint": "https://ops.example.invalid/mcp",
"reachable": true,
"unauthenticated_status": 200,
"tools": [
{
"name": "run_task",
"description": "Runs a shell command on the build machine and returns what it prints.",
"annotations": {},
"input_schema": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "The command line to run."
}
},
"required": [
"command"
]
}
}
],
"tools_source": "probe",
"tools_complete": true
}A server check judges what a probe recorded, not files. The recorded probe above is read the way the scanner's README describes under Evaluating an MCP server probe.
How to fix
Replace the free-text command with named operations that take typed arguments, or run the tool in a sandbox that allows a short list of programs and no network.
Give the tool one operation per task, each with typed arguments such as a file path or a branch name, so the model chooses from a short list and never writes a command. Where a command line cannot be avoided, put the allowed commands in an enum, and ask the person for approval before the tool runs. If the server belongs to someone else, remove the tool from the agent's allowed list and tell its maintainer. The rule reads every new probe, so a server that changes the tool later is checked again.
If it is a false positive
Some servers exist to give an agent a shell, and a person who chose that server and runs it in a sandbox may accept the risk on purpose. The finding is still correct in that case, because the rule cannot see the sandbox, so accept it with a note that says where the tool runs and who approves its use. A tool that only mentions running something in its description, such as a build tool that starts a fixed job, is flagged only if it also has one of the parameters above.
If the finding is not a problem in your case, accept it with a note: in the dashboard a manager or owner can accept a finding and the note is kept with it; with the scanner on its own, add it to the baseline file with a reason and an expiry date.