Language:
Dynamic groups in Microsoft Entra ID are a powerful feature that requires a P1 license or higher. These groups automatically update their membership based on specific rules tied to user attributes. However, if the rules rely on attributes that users can self-modify, they become vulnerable to exploitation.
An attacker with the ability to modify the attribute used in a dynamic group’s rule can manipulate its membership. This misconfiguration can result in unauthorized access or privilege escalation if the group grants access to sensitive resources.
While many attributes in a tenant are not user-modifiable, guest accounts are an exception. A guest user controlled by an attacker, with administrative privileges in the attacker's home tenant, can modify attributes there and exploit the dynamic group rule in the target tenant.
This issue, initially highlighted in security research and penetration testing literature around 2020, remains a viable attack vector in misconfigured environments. Since late 2024, the AADInternals attack tool has included a function to identify exploitable groups.
Possible attack scenario:
displayName
containing specific keywords (e.g., "admin").The risk and ensuing severity depend on these factors:
Dynamic groups simplify administrative tasks but require careful configuration to prevent abuse. By addressing these risks, administrators can keep dynamic groups secure and efficient within Entra ID management.
The most immediate remediation is to avoid user-controlled attributes in rules: do not base dynamic group membership rules on attributes that users, especially guests, can directly modify. However, this significantly reduces the usefulness and flexibility of the feature.
As described, the easiest exploitation method involves inviting a malicious guest. To mitigate this, you can configure policies to restrict guest invitations to a trusted group of users. While this may impact collaboration, it significantly reduces the risk of malicious guest access.
Alternatively, you can exclude these dangerous guests if you do not expect them to be members of the dynamic group. In the rules editor, add an "And" rule on the userType
property with the Not Equals
operator for value Guest
, which generates this rule: and (user.userType -ne "Guest")
. Note that this does not protect against malicious "external members".
However, an internal user with the ability to edit user attributes (such as through permissions granted by an Entra role) can also exploit this, creating additional attack paths. Therefore, carefully review the Entra roles that grant such permissions.
Internal users, as well as less-trusted guests, can easily discover exploitable groups. To mitigate this, you can reduce guests' visibility of groups and their rules. Refer to the recommendations in the related "Unrestricted Guest Accounts" and "Guest Accounts with Equal Access to Normal Accounts" Indicators of Exposure. However, note that this does not prevent internal users from exploiting the groups, as they can still identify target groups.
As a complement, you can regularly monitor dynamic group membership changes to identify and address potential exploitation. You can do this in real-time using the Entra audit log or choose to "Pause processing" in the dynamic group's properties and re-enable it only when you're ready to compare the members before and following the change.
Finally, you can choose to exclude the identified group if you accept the risk, either because you consider it low - due to a minimal likelihood of discovery or exploitation - or because membership in the group does not grant access to sensitive resources.
Name: Dynamic Group Featuring an Exploitable Rule
Codename: DYNAMIC-GROUP-FEATURING-AN-EXPLOITABLE-RULE
Severity: Medium
Type: Microsoft Entra ID Indicator of Exposure