1. Resources
  2. Identity Threats
  3. AWS

AWS iam:AddUserToGroup Privilege Escalation

Also known as: AddUserToGroup privilege escalation, IAM group membership escalation, Self-add to administrators group

A principal with iam:AddUserToGroup adds an IAM user it controls to a group that holds stronger policies and inherits every permission of that group with its next request.

Platform
AWS
Impact
Critical
Last updated
Attack difficulty
Low
Detection difficulty
Low
Privileges required: Specific rights or roles
iam:AddUserToGroup on a group with more permissions than the caller, and control of an IAM user to add (the caller's own user or one whose credentials it holds).
What the attacker gains
All permissions of the group's managed and inline policies for the added user. With an administrators group, full control of the account.

How it works

An IAM group is a collection of IAM users. Managed and inline policies attached to the group apply to every member, and a user can belong to several groups at once. Membership is the whole mechanism: there is no approval, no time limit and no separate activation.

AddUserToGroup adds one user to one group. A principal that is allowed to call it on a privileged group can add a user it controls and receive the group's permissions with the next request. This is privilege escalation by inheritance: the attacker changes who the policies apply to instead of changing the policies.

The permission is often granted more widely than intended. Help desk and onboarding roles get iam:AddUserToGroup on Resource: "*" so that they can place new starters in their team's group, and that grant also covers the administrators group. An identity that holds it looks harmless in a review of attached policies, which makes it a typical shadow admin.

Two properties shape the attack:

  • Only IAM users can be members. A role session cannot join a group. An attacker working from a role adds an IAM user whose credentials it holds, or first creates an access key for a user and then adds that user.
  • The group's policies decide the outcome. If the group grants nothing the user did not already have, the change is redundant. The valuable targets are groups with AdministratorAccess, IAMFullAccess, or the right to assume privileged roles.

Prerequisites

  • Valid credentials in the target account.
  • iam:AddUserToGroup allowed on the target group.
  • Control of an IAM user to add: the caller's own user, or another user whose access key or console password the attacker holds.
  • A group whose policies grant more than the user has. Knowing which group to pick needs iam:ListGroups and iam:ListAttachedGroupPolicies, or a guess at a conventional name.
  • The user must be in fewer than ten groups, the IAM limit for one user.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

1. Find a privileged group

# Groups in the account and the groups the current user is already in
aws iam list-groups
aws iam list-groups-for-user --user-name alice

# What a candidate group grants
aws iam list-attached-group-policies --group-name Administrators

# Who is in it now
aws iam get-group --group-name Administrators

Pacu's iam__privesc_scan module reports the path when the current identity may call AddUserToGroup:

Pacu > run iam__privesc_scan

2. Add the controlled user to the group

aws iam add-user-to-group --group-name Administrators --user-name alice

The command produces no output on success.

3. Use the inherited permissions

aws iam list-groups-for-user --user-name alice
aws sts get-caller-identity

The same access key or console session now carries the group's permissions. No new credential is issued, so the attacker's later calls are signed with the key it already had.

Impact

The added user holds every permission the group grants. With an administrators group that is control of the account: the attacker can read any data, create credentials for other identities and add further backdoors.

The membership also persists. It stays in place until someone removes the user from the group, and it is easy to overlook in a group that already has many members. If the group later gains more policies, the attacker's user inherits those too, with no further action and no further event that names the user.

OPSEC and artifacts

  • Choosing a crowded group. One more member in a large operations group is less visible than a new member in a three-person administrators group. The membership list (GetGroup) still shows the user, and the AddUserToGroup event records the caller, requestParameters.groupName and requestParameters.userName.
  • Adding a different user. Operators avoid adding the identity that makes the call. They add a second user they control, so that the caller and the beneficiary differ and a rule that looks only for self-addition does not match. The event still names both.
  • Short membership. The attacker joins, creates a durable backdoor elsewhere, and leaves the group. RemoveUserFromGroup is recorded as well, and a join and a removal for the same user within minutes is a clear pattern.
  • No policy change to find. Policy monitoring, version history and attachment lists show nothing, because none of them changed. This is the main reason the technique is chosen.
  • What always remains: one IAM management event in CloudTrail, recorded in the US East (N. Virginia) Region, with the caller identity, source address and user agent. Every later action by the user is logged under the user's own name, with nothing that ties it to the group.

Detection

  • Membership changes on sensitive groups. Alert on every AddUserToGroup whose requestParameters.groupName is a group with administrative or IAM permissions. Keep a list of those groups; it is short. The group membership detection rules implement this.
  • Self-addition. The caller's user name equals requestParameters.userName. Legitimate onboarding is done by an administrator or a pipeline for someone else.
  • Unusual caller. The change was made by a workload role, by a user outside the identity team, or from an address that the identity team does not use.
  • Follow-on activity. IAM write calls, access key creation or broad read activity by the added user shortly after the change, where the user did none of this before.
  • Group policy changes belong in the same view. A group can also be made powerful after the attacker joined it, through AttachGroupPolicy or PutGroupPolicy. See policy attachment escalation.
-- Athena, CloudTrail table: group membership changes, with self-additions flagged
SELECT eventtime, eventname, useridentity.arn AS caller,
       json_extract_scalar(requestparameters, '$.groupName') AS group_name,
       json_extract_scalar(requestparameters, '$.userName') AS member,
       useridentity.arn LIKE concat('%:user/', json_extract_scalar(requestparameters, '$.userName')) AS self_add,
       sourceipaddress, errorcode
FROM cloudtrail_logs
WHERE eventsource = 'iam.amazonaws.com'
  AND eventname IN ('AddUserToGroup', 'RemoveUserFromGroup')
  AND eventtime >= '2026-11-28T00:00:00Z'
ORDER BY eventtime

Amazon GuardDuty names AddUserToGroup among the APIs behind its PrivilegeEscalation:IAMUser/AnomalousBehavior finding, which fires when the call is unusual for the identity that made it. It is a useful second signal, not a replacement for the rule on sensitive groups.

Mitigation

  • Scope iam:AddUserToGroup by resource. Grant it only on the group ARNs a role is meant to manage, for example arn:aws:iam::111122223333:group/teams/*, and keep privileged groups outside that path. Never grant it on * to help desk or onboarding identities.
  • Treat privileged groups as privileged identities. Give each one an owner, review its members on a schedule, and alert on every addition and removal.
  • Prefer roles and federation to group-based administrator access. With IAM Identity Center, administrative access is an assignment of a permission set to a person, made in one place and reviewed there. The IAM Identity Center guide covers the setup. See also the IAM basics of users, groups, roles and policies.
  • Apply a permissions boundary to users created by delegated administrators, so that group membership cannot lift them above the boundary.
  • Use a service control policy to deny iam:AddUserToGroup on named administrator groups for every principal except the identity administration role.
  • Keep least privilege on the groups themselves. A group with AdministratorAccess makes every membership change an administrator grant.

Detection rules for this attack

Log events to collect

FAQ

Can an IAM role be added to a group?

No. IAM groups contain IAM users only. A role, a role session or another group cannot be a member. The attack therefore needs an IAM user: either the attacker is signed in as one, or it holds a role with iam:AddUserToGroup and adds a user whose access key or password it controls.

Why do policy monitoring tools miss this escalation?

Nothing about any policy changes. No policy is created, attached or edited, and the group's policies are the same before and after. The only record is the AddUserToGroup event. Monitoring that watches for new administrator policy attachments does not see a user that joins a group which already has one.

How quickly do the new permissions apply?

On the next request the user makes, subject to the short propagation delay of IAM changes. The user does not have to sign in again or get a new key, because IAM evaluates group membership at request time.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.