Not affiliated with AWS
← Back to Attack Library

Privilege Escalation

iam:PassRole + cloudformation:CreateStack

Pass a privileged CloudFormation service role to create and assume a new administrator role.

Required Permissions

  • iam:PassRole
  • cloudformation:CreateStack

Description

A caller with iam:PassRole and cloudformation:CreateStack can supply a privileged service role to CloudFormation. CloudFormation then provisions the template with that role's permissions.

The hackaws agent selects a CloudFormation trusted role that can create IAM roles and inline policies. It creates one named stack per assessed account. The stack contains a new administrator role that trusts the source identity. The agent assumes this role and keeps the stack available while the assessment runs.

At assessment completion, scheduled cleanup deletes the stack and its role. If cleanup cannot complete, the assessment retains a stack deletion command. The technique does not alter existing roles or workloads.

Impact

Administrator credentials for a newly created role until the stack is deleted. The stack and role remain in the account during the assessment.

Detection

Review CloudTrail CreateStack events that specify RoleARN, especially stacks that create AWS::IAM::Role resources. Alert on a new role granting Action: * followed by AssumeRole from the stack creator.

Mitigation

Limit iam:PassRole to approved CloudFormation service roles. Restrict cloudformation:CreateStack and cloudformation:RoleArn, and constrain IAM resource creation in service roles with permissions boundaries or SCPs.