Summary
An OS command injection vulnerability in the example SSM document provisioning script for Trusted Remote Execution (REX) may let an authenticated remote user run arbitrary commands as root on a managed instance. The risk arises when the user is allowed to invoke a Rex-RO or Rex-RW document created from the example script, potentially bypassing Cedar policy enforcement.
Affected context
The issue concerns Rex-RO and Rex-RW SSM documents created using the REX example provisioning script before 2026-07-28. It may affect managed instances where those documents remain available for invocation; exposure depends on account and Region configuration and which users are authorized to run them.
Exploit preconditions
- Attack surface: Invocation of a Rex-RO or Rex-RW SSM document on a managed instance
- Required access: An authenticated remote user permitted to invoke the affected document
- Trigger point: Processing of input by the document's command-execution logic
- Why exploitation is possible: The example script can construct commands in a way that allows OS command injection, potentially executing them as root and bypassing Cedar policy enforcement
Why this happens
The underlying issue is OS command injection, mapped to CWE-78. The vulnerable pattern occurs when data that may be influenced by a caller is incorporated into an operating-system command without adequate separation or safe handling. In this case, the example SSM document provisioning script can allow command execution with root privileges when an authorized user invokes an affected document.
Potential impact
- An attacker with the required document permissions could execute arbitrary commands as root on a managed instance.
- Instance data or services could be altered, disrupted, or accessed.
- Cedar policy enforcement could be bypassed for actions performed through the affected execution path.
- Compromise of a managed instance could create opportunities for further impact in its environment.
General mitigation guidance
Reduce exposure by identifying and deleting Rex-RO and Rex-RW SSM documents created from the example script in every account and Region where it was run. For command execution designs, prefer APIs that pass arguments without invoking a shell; where shell use is necessary, avoid building commands from caller-controlled data and apply strict validation. Limit who can create or invoke SSM documents, use least-privilege execution identities, and retain policy enforcement at the points where actions are authorized.
How teams detect issues like this
- Inventory SSM documents across accounts and Regions to identify Rex-RO and Rex-RW documents created from the example script.
- Review document definitions and provisioning code for shell command construction that incorporates caller-controlled values.
- Use static analysis rules to flag shell execution APIs and unsafe command interpolation.
- Monitor document creation, modification, and invocation events, and enforce policies that restrict document permissions and command-execution patterns.

