How the attack works
A dynamic group in Google Workspace or Cloud Identity has no member list. Its members are the users who match a membership query on user attributes such as department, country or a custom attribute. Google states that people cannot be added to such a group manually and that the way to change the members is to change the query. Dynamic groups can be mailing lists and they can be security groups, and Google Cloud accepts groups as principals in access policies, which makes them a common way to hand out access.
That turns the query into an access control. An attacker with the Groups administrator privilege widens it, for example by adding a second condition joined with or, or by removing a condition, and the account they control now matches. The change is made on the group and not on the account, nobody adds a member by hand, and the group's role bindings do not change. A query that is narrowed can also push legitimate members out.
Google's reference for the Enterprise Groups audit documents add_dynamic_group_query, with the query, and change_dynamic_group_query, with the old and the new value, both with the group. Organizations that share Workspace data with Google Cloud receive the Enterprise Groups audit in Cloud Audit Logs at organization level as Admin Activity entries of cloudidentity.googleapis.com under two method names, of which google.apps.cloudidentity.groups.v1.GroupsService.UpdateGroup is by its name the one for changes to a group. The rule on this page reads that method and looks for the dynamic group query in the event parameters.
What an attacker needs
- An admin account with the Groups administrator privilege, or a super admin account.
- A dynamic group that carries access, such as a security group used in Google Cloud IAM policies.
- An edition with dynamic groups. Google lists the supported editions on its help page.
Impact
Every account that matches the new query becomes a member and receives what the group grants, such as roles on Google Cloud resources, shared files and the group's mail. The change is one edit of a text field and does not show up as a role grant.
Detection rules
Dynamic Group Membership Query Added or Changed in Google Workspace
Detects a membership query being added to or changed on a dynamic group of a Google Workspace or Cloud Identity account (Enterprise Groups audit events add_dynamic_group_query and change_dynamic_group_query, the second rendered as "{actor} changed dynamic group query from {old_value} to {new_value} in group {group_id}"). The members of a dynamic group are the users who match its query, so a wider query adds members without anyone adding them by hand. The rule reads the Enterprise Groups audit in Cloud Audit Logs (service cloudidentity.googleapis.com, method google.apps.cloudidentity.groups.v1.GroupsService.UpdateGroup) and searches the serialized event parameters in protoPayload.metadata for dynamic_group_query, which is part of both event names and the name of the query parameter. Google documents the events and the method but publishes no example of a group entry, which is why the level is low. Change the query of a test group and compare the entry before relying on the rule. The group is the parameter group_id and the admin is in principalEmail. The entry reaches Cloud Audit Logs as an Admin Activity entry at organization level once Google Workspace data sharing with Google Cloud is enabled, and reaches the SIEM only when the organization-level logs are routed to it.
title: Dynamic Group Membership Query Added or Changed in Google Workspace
id: 7f3c32b7-b870-4b03-a040-67cbb09d1e4e
status: experimental
description: >-
Detects a membership query being added to or changed on a dynamic group
of a Google Workspace or Cloud Identity account (Enterprise Groups audit
events add_dynamic_group_query and change_dynamic_group_query, the
second rendered as "{actor} changed dynamic group query from
{old_value} to {new_value} in group {group_id}"). The members of a
dynamic group are the users who match its query, so a wider query adds
members without anyone adding them by hand. The rule reads the
Enterprise Groups audit in Cloud Audit Logs (service
cloudidentity.googleapis.com, method
google.apps.cloudidentity.groups.v1.GroupsService.UpdateGroup) and
searches the serialized event parameters in protoPayload.metadata for
dynamic_group_query, which is part of both event names and the name of
the query parameter. Google documents the events and the method but
publishes no example of a group entry, which is why the level is low.
Change the query of a test group and compare the entry before relying on
the rule. The group is the parameter group_id and the admin is in
principalEmail. The entry reaches Cloud Audit Logs as an Admin Activity
entry at organization level once Google Workspace data sharing with
Google Cloud is enabled, and reaches the SIEM only when the
organization-level logs are routed to it.
references:
- https://docs.cloud.google.com/logging/docs/audit/gsuite-audit-logging
- https://developers.google.com/workspace/admin/reports/v1/appendix/activity/groups-enterprise
- https://knowledge.workspace.google.com/admin/groups/manage-membership-automatically-with-dynamic-groups
- https://attack.mitre.org/techniques/T1098/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: cloudidentity.googleapis.com
protoPayload.methodName: google.apps.cloudidentity.groups.v1.GroupsService.UpdateGroup
selection_query:
protoPayload.metadata.event|contains: dynamic_group_query
condition: selection and selection_query
falsepositives:
- Group administrators who create a dynamic group or adjust its query after a reorganization. Dynamic groups change rarely. Verify each change against a change record and compare the old and the new query.
level: low
False positives
- Group administrators who create a dynamic group or adjust its query after a reorganization. Dynamic groups change rarely. Verify each change against a change record and compare the old and the new query.
Triage
- Read the event parameters in protoPayload.metadata. group_id names the group, dynamic_group_query the query of a new dynamic group, and old_value and new_value the query before and after a change.
- Compare the old and the new query. A new condition joined with or, a removed condition or a removed exclusion widens the group.
- Use the preview of the query in the Admin console to list the users who match now, and compare them with the members the group is meant to have.
- Find out what the group grants. Check Google Cloud IAM policies that name it, shared drives and files, and settings scoped to it.
- Identify the admin who made the change (principalEmail) and confirm it against a change request.
Response
Once the attack is confirmed:
- Set the membership query back to the recorded one and confirm with the preview that only the intended users match.
- Review what the unintended members did with the group's access while they had it, in Google Cloud audit logs and in Drive.
- Secure the admin account that changed the query. Reset its password, reset its sign-in cookies and review its admin roles.
- Check the attributes of the accounts that matched the widened query for recent edits, because an attribute change is the other way into a dynamic group.
- Move privileged access from the dynamic group to a group with explicit members.
Mitigation
- Avoid dynamic groups for privileged access. Use groups with explicit members for roles on Google Cloud resources, so that every new member is a visible change.
- Give the Groups administrator privilege to few administrators, because it controls the queries of all dynamic groups.
- Build queries on attributes that users and helpdesk staff cannot edit, and review who can change those attributes.
- Record the query of every dynamic group that carries access and compare the groups with the record regularly.
- Share Workspace data with Google Cloud and route the organization-level audit logs to the SIEM.
Frequently asked questions
Does a changed query show which accounts became members?
No. Google states that people cannot be added to a dynamic group manually and that membership follows the membership query. The event that records the change carries the group and the query, not the accounts that match it. Google's reference has a separate event for a member added to a group and does not say whether it is written when a query adds one. Use the query preview in the Admin console to see who matches now.
Is changing the query the only way into a dynamic group?
No. The query tests user attributes such as department, address or custom attributes. Whoever can edit those attributes on a user account can make the account match an unchanged query. That is a change to a user profile and is recorded by other events. The rule on this page sees only changes to the query.
How sure is it that the rule matches these events in Cloud Audit Logs?
Google documents the two events with their parameters and states that Enterprise Groups audit activities can be forwarded to Cloud Audit Logs. Its Cloud Audit Logs page lists two method names for that log and shows, in a sign-in example, that the event name and parameters arrive in `protoPayload.metadata`. Google publishes no example of a group entry, so change the query of a test group and compare the entry with the rule.
References
- MITRE ATT&CK T1098: Account Manipulation
- Manage membership automatically with dynamic groups
- Create membership queries for dynamic groups
- IAM principals (Google groups)
- Audit logs for Google Workspace (Cloud Audit Logs, Enterprise Groups Audit)
- Enterprise Groups audit events (add_dynamic_group_query, change_dynamic_group_query)