Command injection: definition and example
Command injection is a flaw in which text from an untrusted source ends up interpreted by a shell or operating system call. In MCP the text can come from a model's tool arguments or from a server, such as an OAuth authorization URL. The usual fix is to avoid the shell and validate input against an allowlist.
Facts read on .
Example
The MCP security best practices say clients must not use shell commands such as cmd.exe, sh or PowerShell to open URLs, and must only allow http and https schemes for authorization URLs.
Sources
- MCP Security Best Practices, 2026-07-28 revision (modelcontextprotocol.io), read