Amazon Web Services (AWS) has published an advisory for CVE-2026-87911 (CVSS score 8.8, High), an OS command injection vulnerability in the open-source AWS Systems Manager (SSM) Agent (amazon-ssm-agent). The vulnerability allows attackers who possess local unprivileged shell access on an EC2 instance to execute arbitrary commands as root (or SYSTEM on Windows) by manipulating parameter expansion arrays in queued SSM document executions.

Executive Threat Summary & Exploit Landscape

AWS Systems Manager is an operational hub enabling automated fleet management, patch baseline automation, and terminal access without requiring public inbound SSH/RDP ports. The SSM Agent runs continuously with the highest operating system privileges to execute automation scripts dispatched by AWS CloudTrail and Systems Manager State Manager.

Under CVE-2026-87911, when an administrator or automated CI/CD pipeline triggers an AWS-RunShellScript or custom SSM document, parameter interpolation logic failed to escape backticks and nested shell delimiters. A local user on the instance could write crafted arguments into shared IPC temporary state files, intercepting the command stream and executing root code on the underlying operating system.

Vulnerability Mechanics & Technical Root Cause (CWE-78)

The flaw occurs in the document execution engine written in Go (core/app/plugins/executecommand). When parsing document parameters containing JSON arrays, the agent evaluates parameter substitution using string concatenation before constructing the process argument vector:

// Vulnerable parameter string expansion in amazon-ssm-agent
func (p *Plugin) buildShellCommand(command string, params map[string]string) string {
    // VULNERABLE: Direct string replacement allows command expansion injection
    for k, v := range params {
        command = strings.ReplaceAll(command, "{{" + k + "}}", v)
    }
    return command // Passed directly to /bin/sh -c
}

If an input parameter contained nested shell syntax such as `cat /etc/shadow > /tmp/out`, the Bourne shell (/bin/sh) executed the nested payload with root privileges when invoking the document script. This completely bypassed parameter sanitation checks enforced by the AWS SSM API layer.

Vulnerable Software Versions & Patch Status Matrix

Platform / Distribution Vulnerable Builds Fixed Release Update Status
Amazon Linux 2 / 2023 amazon-ssm-agent < 3.3.1620.0 3.3.1620.0-1 YUM / DNF Package Live
Ubuntu Linux (Snap / Deb) amazon-ssm-agent < 3.3.1620.0 3.3.1620.0 or Snap Rev 7990+ Snap / APT Live
RHEL / Rocky / CentOS amazon-ssm-agent < 3.3.1620.0 3.3.1620.0-1.el8/el9 RPM Updated
Windows Server AMI SSM Agent < 3.3.1620.0 3.3.1620.0 (MSI update) MSI Available

Step-by-Step Remediation Playbook & Patch Commands

Cloud infrastructure teams should immediately upgrade the agent across all cloud instances:

  1. Ubuntu Linux (Snap Package):
    # Refresh snap package
    sudo snap refresh amazon-ssm-agent
    
    # Verify agent version
    snap list amazon-ssm-agent
  2. Amazon Linux 2023 & AL2:
    # Upgrade via dnf/yum
    sudo dnf upgrade amazon-ssm-agent -y || sudo yum update amazon-ssm-agent -y
    
    # Restart daemon and verify build
    sudo systemctl restart amazon-ssm-agent
    amazon-ssm-agent --version
  3. Debian / Ubuntu (Native DEB):
    sudo apt-get update
    sudo apt-get install --only-upgrade amazon-ssm-agent
    sudo systemctl status amazon-ssm-agent
  4. Automated Fleet-Wide Patching via AWS Systems Manager: Deploy an SSM State Manager association executing AWS-UpdateSSMAgent across all managed nodes automatically.

Threat Detection, Log Auditing & Forensic Queries

Audit SSM agent execution logs located in /var/log/amazon/ssm/amazon-ssm-agent.log for abnormal parameter tokens:

# Search for command injection characters in document execution parameters
grep -E "(documentExecution.*[`$();|&])" /var/log/amazon/ssm/amazon-ssm-agent.log

# Check auditd for /bin/sh spawned by amazon-ssm-agent with non-standard parent PIDs
ausearch -p $(pgrep amazon-ssm-agent) -i