1. Resources
  2. Detection rules
  3. IAM Policy Version Set as Default

IAM Policy Version Set as Default detection rules

An attacker pushes a new version of a customer-managed IAM policy, or promotes an old one, so that every identity the policy is attached to gains the permissions they wrote.

Platform
AWS
Severity
High
Log source
AWS CloudTrail
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Permission to call iam:CreatePolicyVersion or iam:SetDefaultPolicyVersion on a customer-managed policy attached to an identity the attacker controls or can assume.
Impact
The permissions of the new default version, often administrator, for every user, group and role the policy is attached to, without any visible change in attachments.
Response
Make the last approved version the default again and delete the version the attacker created or promoted, then contain the caller and the attached identities.
Mitigation
Restrict iam:CreatePolicyVersion and iam:SetDefaultPolicyVersion to IAM administrators, and delete non-default policy versions that grant more than the default.
CloudTrail events
SetDefaultPolicyVersionCreatePolicyVersion

How the attack works

Customer-managed IAM policies keep up to five versions, and only the default version is enforced. CreatePolicyVersion with setAsDefault true replaces the policy's effective permissions in one call; SetDefaultPolicyVersion activates a version that already exists, including a dormant one that grants far more than the current default. Neither call creates a new policy or attachment, so controls that watch for new policies or attachments miss it.

A principal allowed to change a policy that is attached to itself (or to a role it can assume) can grant itself administrator rights this way. CloudTrail records the caller in userIdentity, the policy in requestParameters.policyArn, and either the new document and setAsDefault flag (CreatePolicyVersion) or the promoted versionId (SetDefaultPolicyVersion).

What an attacker needs

  • Credentials for a principal allowed to call iam:CreatePolicyVersion or iam:SetDefaultPolicyVersion on a customer-managed policy.
  • The policy is attached to an identity the attacker controls or can assume, or already holds a non-default version with broader permissions.

Impact

The permissions of the new default version, often administrator, for every user, group and role the policy is attached to, without any visible change in attachments.

Detection rules

IAM Default Policy Version Changed

Detects SetDefaultPolicyVersion calls, which make an existing version of a customer-managed policy the enforced one. Compare the promoted version (requestParameters.versionId) with the previous default. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.

LevelMediumStatusExperimentalLog sourceAWS CloudTrail
title: IAM Default Policy Version Changed
id: 839d8b95-0512-456c-a77b-de53faf39fac
status: experimental
description: >-
  Detects SetDefaultPolicyVersion calls, which make an existing version of a
  customer-managed policy the enforced one. Compare the promoted version
  (requestParameters.versionId) with the previous default.
  It also matches attempts that failed (errorCode present): check errorCode,
  because an unauthorized attempt is worth seeing.
references:
  - https://docs.aws.amazon.com/IAM/latest/APIReference/API_SetDefaultPolicyVersion.html
  - https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-10
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.003
logsource:
  product: aws
  service: cloudtrail
detection:
  selection:
    eventSource: iam.amazonaws.com
    eventName: SetDefaultPolicyVersion
  condition: selection
falsepositives:
  - Rollbacks of a policy change by the identity team; confirm with the change record.
level: medium

False positives

  • Rollbacks of a policy change by the identity team; confirm with the change record.

IAM Policy Version Created and Set as Default

Detects CreatePolicyVersion calls with setAsDefault true, which replace a customer-managed policy's effective permissions immediately. Review requestParameters.policyDocument for wildcard actions and resources. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.

LevelMediumStatusExperimentalLog sourceAWS CloudTrail
title: IAM Policy Version Created and Set as Default
id: 5b863133-add4-4652-a4b5-7152123ee13c
status: experimental
description: >-
  Detects CreatePolicyVersion calls with setAsDefault true, which replace a
  customer-managed policy's effective permissions immediately. Review
  requestParameters.policyDocument for wildcard actions and resources.
  It also matches attempts that failed (errorCode present): check errorCode,
  because an unauthorized attempt is worth seeing.
references:
  - https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreatePolicyVersion.html
  - https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-10
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.003
logsource:
  product: aws
  service: cloudtrail
detection:
  selection:
    eventSource: iam.amazonaws.com
    eventName: CreatePolicyVersion
    requestParameters.setAsDefault: 'true'
  condition: selection
falsepositives:
  - Routine policy updates; console edits and infrastructure-as-code tools such as CloudFormation and Terraform update managed policies this way. Allow-list the deployment roles and review changes made by anyone else.
level: medium

False positives

  • Routine policy updates; console edits and infrastructure-as-code tools such as CloudFormation and Terraform update managed policies this way. Allow-list the deployment roles and review changes made by anyone else.

Triage

  • Read the new or promoted version (GetPolicyVersion) and compare it with the previous default; look for Action "*", iam:* and Resource "*".
  • List the identities the policy is attached to and check whether the caller is one of them or can assume one.
  • If not approved, set the previous version back as default, delete the new version and review the caller's activity.

Response

Once the attack is confirmed:

  1. Make the last approved version the default again. Permissions are evaluated on every request, so every identity the policy is attached to loses the added permissions, in sessions that already exist as well.
  2. Delete the version the attacker created or promoted, and every other non-default version that grants more than the approved one.
  3. Contain the caller and the attached identities that could have used the wider permissions, by deactivating access keys and revoking the active sessions of roles.
  4. Review what the attached identities did while the version was in force, and remove the users, access keys, roles and policy changes created in that time.
  5. Take the permission to change this policy away from the identities it is attached to, and confirm that the default version stays the approved one.

Mitigation

  • Restrict iam:CreatePolicyVersion and iam:SetDefaultPolicyVersion to IAM administrators; never grant them on policies attached to the caller.
  • Delete non-default policy versions that grant more than the default, so there is nothing dormant to promote.
  • Replace wildcard IAM actions (iam:*) in customer-managed policies with the specific actions needed.

Frequently asked questions

Does the rule fire when a new version is created but not made the default?

No. The first rule matches `CreatePolicyVersion` only when `setAsDefault` is true. Only the default version is enforced, so a version created without the flag changes nothing until it is promoted. The promotion appears as `SetDefaultPolicyVersion`, which the second rule matches. A dormant version that grants more than the default is still worth finding and deleting.

How can a rollback to an older version be an attack?

Customer-managed policies keep up to five versions, and only the default one is enforced. An older version can grant far more than the current default. `SetDefaultPolicyVersion` activates it in one call, without a new policy document to review, so a promotion that looks like a rollback has to be compared with the previous default.

Which identities are affected when the default version changes?

Every user, group and role the policy is attached to receives the permissions of the new default version, with no visible change in attachments. List the attached identities to see how far the change reaches, and check whether the caller is one of them or can assume one.

How do routine policy updates look in these rules?

The same as an attack. Console edits and infrastructure-as-code tools such as CloudFormation and Terraform update managed policies by creating a new default version. Allow-list the deployment roles and review changes made by anyone else, with attention to wildcard actions and resources in the new document.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.