T05 · Unauthorized Access and Privilege Escalation
- Location
references/ram-policies.md:30- Finding
Fleet-Wide Remote Command Execution Violates Least Privilege
- Content
View full analysis
Vulnerability Details
File Location:
references/ram-policies.md:30-42
Vulnerability Type: Excessively broad remote command execution permission
Risk Level: HighVulnerable Code
json { "Version": "1", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:DescribeInstances", "ecs:DescribeInstanceAttribute", "ecs:DescribeInstanceHistoryEvents", "ecs:DescribeCloudAssistantStatus", "ecs:RunCommand", "ecs:DescribeInvocations" ], "Resource": "*" } ] }Technical Analysis
The policy grants
ecs:RunCommand, which permits remote shell or PowerShell command execution through Alibaba Cloud Assistant. Unlike the other listedDescribe*operations, this is a privileged, mutating capability that can execute arbitrary commands in the guest operating system.Combining
ecs:RunCommandwith"Resource": "*"allows the credential to target every ECS resource to which the policy applies rather than only the instance being diagnosed. The Skill only needs to diagnose a user-selected instance, so fleet-wide scope exceeds the minimum privileges necessary for its declared function.The documentation provides command templates containing instance and script-content parameters. If either value is improperly influenced, the broad policy does not provide a resource-level boundary to contain misuse.
Attack Path
- An administrator grants the documented RAM policy to the identity used by the Skill.
- An attacker influences the target instance ID or the generated Cloud Assistant command content through compromised input, workflow manipulation, or agent misuse.
- The Skill invokes
ecs:RunCommandagainst an arbitrary ECS instance covered by"Resource": "*". - Cloud Assistant executes the submitted shell or PowerShell content using its privileged execution context.
- The attacker can read protected data, modify system configuration, install persistence, or di ...[truncated 802 chars]
- Remediation
View remediation
Remediation Suggestions
- Restrict the policy to explicitly approved instance ARNs wherever Alibaba Cloud RAM supports resource-level constraints for the relevant action.
- If resource-level restriction is unavailable, enforce instance-ID and region allowlists through an external authorization layer that cannot be modified through prompt input.
- Use a dedicated, short-lived role scoped to one diagnostic session and one approved instance.
- Separate read-only cloud API diagnosis from guest operating-system command execution. Request the latter permission only when it is actually needed.
- Replace dynamically generated scripts with fixed, reviewed diagnostic scripts or a strict command allowlist.
- Validate target identifiers against values returned by trusted Alibaba Cloud APIs rather than accepting arbitrary command targets.
- Require explicit user confirmation immediately before invoking Cloud Assistant.
- Record the target instance, exact script hash, requesting identity, and execution result in an immutable audit log.
