Not affiliated with AWS
← Back to Attack Library

Privilege Escalation

cloudformation:UpdateStack

Update an existing CloudFormation stack that already has a privileged service role, without passing the role again.

Required Permissions

  • cloudformation:UpdateStack
  • cloudformation:ListStacks
  • cloudformation:DescribeStacks
  • cloudformation:GetTemplate

Description

A CloudFormation stack keeps the service role assigned when it was created. A caller with cloudformation:UpdateStack on that stack can submit a new template without iam:PassRole. CloudFormation applies the update using its existing service role.

The hackaws agent selects one stack with a CloudFormation trusted role able to create IAM roles and inline policies. It backs up the original JSON template, adds an administrator role that trusts the source identity, updates the stack, and assumes the new role. The original stack remains in place during the assessment.

After the assessment, scheduled cleanup restores the exact original template and confirms the temporary role is removed before deleting credentials. If someone else changes the stack template in the meantime, cleanup stops rather than overwriting that change and leaves a recovery item for review. The assessment requires cloudformation:ListStacks, cloudformation:DescribeStacks, and cloudformation:GetTemplate for safe discovery and restoration.

Impact

Administrator credentials from an existing stack service role. The temporary role and stack template change remain until restoration completes.

Detection

Review CloudTrail UpdateStack events on stacks with privileged service roles, especially updates that add AWS::IAM::Role resources. Correlate with subsequent AssumeRole calls.

Mitigation

Limit cloudformation:UpdateStack to approved deployment identities and stacks. Keep service roles least privileged and require review of IAM resource changes in stack templates.