1. Resources
  2. Detection rules
  3. IAM User Added to a Group

IAM User Added to a Group detection rules

An attacker with iam:AddUserToGroup puts an IAM user they control into a group that holds stronger policies, such as an administrators group, and inherits every permission of that group.

Platform
AWS
Severity
High
Log source
AWS CloudTrail
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Credentials allowed to call iam:AddUserToGroup on a privileged group, and an IAM user the attacker controls that has no permissions boundary capping it.
Impact
The permissions of the group, which for an administrators group is full control of the account, on a user the attacker can keep using.
Response
Remove the user from the group, then contain the added user and the principal that made the change and review what the user did while it was a member.
Mitigation
Restrict iam:AddUserToGroup to identity administrators, scope it to named group ARNs, and keep privileged groups few and reviewed.
CloudTrail event
AddUserToGroup

How the attack works

An IAM group is a collection of IAM users. Policies attached to the group, managed or inline, apply to every user in it, and a user can belong to several groups at once. AddUserToGroup adds one user to one group. A principal allowed to call it on a privileged group can add its own user, or another user whose credentials it holds, and receives the permissions of the group with the next request.

No policy is created, attached or changed in this path, so monitoring that watches policy changes does not see it. The only event is the membership change. CloudTrail records it under iam.amazonaws.com with the caller in userIdentity, the group in requestParameters.groupName and the user in requestParameters.userName.

What an attacker needs

  • Credentials for a principal allowed to call iam:AddUserToGroup on the target group.
  • An IAM user the attacker controls, which can be the caller itself or a user whose access key or password the attacker holds.
  • No permissions boundary on that user and no service control policy that caps what the group's policies grant.

Impact

The permissions of the group, which for an administrators group is full control of the account. The membership also works as persistence: it survives the rotation of the credentials that were used to make the change.

Detection rules

IAM User Added to a Group

Detects AddUserToGroup calls, which add an IAM user to an IAM group and give the user every permission of the policies the group holds. The event names the group (requestParameters.groupName) and the user (requestParameters.userName) but not the group's policies, so the rule cannot tell a privileged group from any other. Triage by comparing the caller (userIdentity.arn) with the added user and by looking up what the group grants. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.

LevelMediumStatusExperimentalLog sourceAWS CloudTrail
title: IAM User Added to a Group
id: 46142871-17ea-4140-a2f0-ad751506dc29
status: experimental
description: >-
  Detects AddUserToGroup calls, which add an IAM user to an IAM group and give
  the user every permission of the policies the group holds. The event names
  the group (requestParameters.groupName) and the user
  (requestParameters.userName) but not the group's policies, so the rule
  cannot tell a privileged group from any other. Triage by comparing the
  caller (userIdentity.arn) with the added user and by looking up what the
  group grants.
  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_AddUserToGroup.html
  - https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html
author: Forestall
date: 2026-11-16
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.003
logsource:
  product: aws
  service: cloudtrail
detection:
  selection:
    eventSource: iam.amazonaws.com
    eventName: AddUserToGroup
  condition: selection
falsepositives:
  - Onboarding and role changes handled by identity administrators or identity automation; allow-list those callers, or limit the rule to the names of the groups that hold privileged policies.
level: medium

False positives

  • Onboarding and role changes handled by identity administrators or identity automation; allow-list those callers, or limit the rule to the names of the groups that hold privileged policies.

Triage

  • Compare the caller (userIdentity.arn) with requestParameters.userName. A user that adds itself to a group is the strongest signal.
  • Look up which policies the group in requestParameters.groupName holds, managed and inline. The alert matters in proportion to what the group grants.
  • Check errorCode. A failed attempt shows that someone tested the permission.
  • Review what the added user did after the change, and whether the user was created or received a new access key or password shortly before it.

Response

Once the attack is confirmed:

  1. Remove the user from the group. Permissions are evaluated on every request, so the user loses the group's permissions at once.
  2. Contain the added user and the principal that made the change. Deactivate their access keys, reset console passwords, and revoke the sessions of roles involved.
  3. Review what the user did while it was a member. Role sessions it opened in that time keep the permissions of the role until they expire, and what it created stays in place.
  4. Search CloudTrail for other membership changes by the same caller, and compare the membership of privileged groups with the approved list.
  5. Take the permission to change group membership away from the caller before its credentials go back into use.

Mitigation

  • Restrict iam:AddUserToGroup to identity administrators, and scope it to named group ARNs in the Resource element so that delegated administrators cannot fill privileged groups.
  • Keep the number of groups with administrator or IAM write policies small, and review their membership on a schedule.
  • Set permissions boundaries on IAM users, so that membership in a group cannot grant more than the boundary allows.
  • Give people access through IAM Identity Center or federation with temporary credentials, so that few IAM users exist to be added to groups.
  • Remove wildcard IAM actions (iam:*) from customer managed policies so that ordinary principals cannot change group membership.

Frequently asked questions

Does the rule know whether the group is privileged?

No. It matches every AddUserToGroup call. The event names the group but says nothing about the policies the group holds, so the rule cannot tell an administrators group from a group with read access to one bucket. Look up the group's policies in triage, or limit the rule in your SIEM to the names of your privileged groups.

Why does a membership change not show up in policy monitoring?

Because no policy is touched. The group already holds its policies, and AddUserToGroup changes only who is in the group. Rules and metric filters that watch the attach, put and policy version calls stay silent, although the effective permissions of the user have changed completely.

Does this rule cover groups in IAM Identity Center?

No. IAM groups and Identity Center groups are different objects. Membership of an Identity Center group is changed in the Identity Store, where the public API call is CreateGroupMembership under identitystore.amazonaws.com and console actions are recorded under sso-directory.amazonaws.com. This rule matches the IAM call under iam.amazonaws.com only.

Can IAM groups be nested to hide a membership?

No. AWS documents that user groups cannot be nested and contain only users. Every member of a group is added directly with AddUserToGroup, so each new member of a privileged group produces its own event.

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.