Amazon Web Services has published security advisory 2026-121-AWS documenting an argument injection vulnerability, CVE-2026-97662, in its open-source security-agent-mcp-server. The tool implements the emerging Model Context Protocol (MCP) standard, enabling autonomous AI code-review agents and IDE extensions to query security diffs. Flawed parameter parsing in the repository diff scan handler enables an attacker to supply leading hyphens that are treated as command flags by underlying version control binaries, breaking directory confinement.

Argument Injection Breakdown (CWE-88)

The Model Context Protocol establishes standardized JSON-RPC communication between LLM client applications and backend tools. In security-agent-mcp-server, the diff tool allows an LLM agent to inspect changes between two Git revisions:

{
  "method": "tools/call",
  "params": {
    "name": "diff",
    "arguments": {
      "base": "main",
      "target": "--output=/path/to/target/file"
    }
  }
}

Because the server passed the user-supplied target parameter directly into the git diff invocation without preceding positional argument delimiters (such as --), Git interpreted flags such as --output as command options. An attacker manipulating the target branch reference in a pull request could force the Git process to overwrite, create, or truncate critical files within the host environment.

Vulnerable Software Versions & Remediation Matrix

Package / Module Name Vulnerable Versions Fixed / Remediated Release Remediation Action Required
security-agent-mcp-server (PyPI) Versions < 0.2.0 0.2.0 Upgrade package via pip or poetry
awslabs/mcp GitHub Repository Commits prior to tag v0.2.0 v0.2.0 Git pull and rebuild local virtualenv

Step-by-Step Remediation Playbook & Patch Commands

AWS recommends immediate migration to the patched release:

  1. Upgrade Package via Pip / Poetry:
    # Upgrade package via pip in active environment
    pip install --upgrade "security-agent-mcp-server>=0.2.0"
    
    # Alternatively, update poetry dependency
    poetry update security-agent-mcp-server
    
    # Verify installed release version
    pip show security-agent-mcp-server | grep Version
  2. Audit CI/CD Runner Workspaces:
    # Audit active MCP server configuration in Claude Desktop or IDE configuration
    cat ~/.config/Claude/claude_desktop_config.json | grep -i "security-agent-mcp-server"
  3. Enforce Argument Sanitization Wrapper:
    # Defensive code pattern to prevent argument injection in subprocess calls
    import re
    
    def sanitize_git_ref(ref: str) -> str:
        if ref.startswith("-") or not re.match(r"^[a-zA-Z0-9._/-]+$", ref):
            raise ValueError(f"Illegal Git reference: {ref}")
        return ref

Threat Hunting: Inspect Git Command Invocations

Audit developer workstation process telemetry for Git commands launched with unexpected output redirects:

# Query Linux auditd logs for git diff commands with file output arguments
ausearch -c git -m EXECVE | grep -E "diff.*--output"