How the attack works
A dynamic group makes resources act as principals. It has no member list: a matching rule decides which compute instances, functions or other resources belong to it, and policies written for the dynamic group then apply to every match. A rule such as instance.compartment.id = '<compartment_ocid>' includes every instance that exists or is later created in that compartment. Updating a rule needs only use dynamic-groups; creating a group needs manage dynamic-groups, and a new group gains rights only once a policy names it.
So there are two abuse patterns. With update rights, an attacker widens the rule of a dynamic group that already has strong policies, for example by adding the OCID of an instance they control. With create rights plus manage policies, they build a new privileged principal out of a resource they own. Oracle states the consequence plainly: any user who can access an instance inherits the privileges granted to it. The Audit log records com.oraclecloud.identityControlPlane.CreateDynamicGroup and UpdateDynamicGroup, with the dynamic group name in data.resourceName.
Collection: ship the _Audit log group of the root compartment (subcompartments included) to the SIEM through a service connector and a stream, and include the home region, where IAM resources are changed.
What an attacker needs
- A principal with
use dynamic-groups(to change a matching rule) ormanage dynamic-groups(to create one). In tenancies with identity domains, the identity domain administrator and security administrator roles also manage dynamic groups. - A resource the attacker controls that the new rule matches, or the right to create one in a matched compartment.
- For a new dynamic group to matter, a policy that names it.
Impact
The matched resource can call OCI APIs with every right the dynamic group's policies grant, without any user credential. If those policies include manage all-resources, manage policies or rights over users and groups, the result is control of the tenancy from a workload identity that is easy to overlook in user access reviews.
Detection rules
OCI Dynamic Group Created or Updated
Detects CreateDynamicGroup and UpdateDynamicGroup operations of the OCI IAM control plane. An update can change the matching rule and so the resources that inherit the dynamic group's policies. Review the rule of the group named in data.resourceName and the policies that name it.
title: OCI Dynamic Group Created or Updated
id: 0b142252-a514-4342-b1ad-ab96d1f3f9e5
status: experimental
description: >-
Detects CreateDynamicGroup and UpdateDynamicGroup operations of the OCI IAM
control plane. An update can change the matching rule and so the resources
that inherit the dynamic group's policies. Review the rule of the group named
in data.resourceName and the policies that name it.
references:
- https://docs.oracle.com/en-us/iaas/Content/Events/Reference/eventsproducers.htm
- https://docs.oracle.com/en-us/iaas/Content/Identity/dynamicgroups/Writing_Matching_Rules_to_Define_Dynamic_Groups.htm
- https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-11
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: oci
service: audit
detection:
selection:
eventType:
- com.oraclecloud.identityControlPlane.CreateDynamicGroup
- com.oraclecloud.identityControlPlane.UpdateDynamicGroup
condition: selection
falsepositives:
- Platform teams onboarding a workload to instance or resource principals, and infrastructure-as-code pipelines. Allow-list those callers by data.identity.principalName.
- Description-only updates, which use the same operation as a rule change.
level: medium
False positives
- Platform teams onboarding a workload to instance or resource principals, and infrastructure-as-code pipelines. Allow-list those callers by data.identity.principalName.
- Description-only updates, which use the same operation as a rule change.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Dynamic group created or changed and a policy written by the same caller shortly after
A new dynamic group gains rights only once a policy names it, so building a privileged workload identity takes two steps by someone who holds both rights. A dynamic group created or changed and a policy created or updated by the same caller within a short time is that construction, and a new instance launched by the same caller in the same period completes it.
- The Audit log records
com.oraclecloud.identityControlPlane.CreateDynamicGrouporUpdateDynamicGroup. Keep the dynamic group name indata.resourceNameand the caller indata.identity.principalIdanddata.identity.principalName. - Within 60 minutes the same
data.identity.principalIdcreates or updates a policy:com.oraclecloud.identityControlPlane.CreatePolicyorUpdatePolicy, with the policy name indata.resourceName. - Read that policy and check whether a statement names the dynamic group, and with which verbs and resource types.
- Look for events from the same caller in the same period whose
data.eventNameisLaunchInstance, and compare the compartment (data.compartmentName) with the one the matching rule names.
EventsCreateDynamicGroupUpdateDynamicGroupCreatePolicyUpdatePolicyLaunchInstance
LimitsOnboarding a workload that calls OCI APIs produces the same pair, and pipelines often deploy both together, so exclude the deployment identities. A policy written earlier for an existing dynamic group, and two different callers working together, are not seen. The events carry neither the matching rule nor the policy text. The 60 minutes are a starting point.
Triage
- Read the dynamic group named in data.resourceName (matching rule and description) and compare the rule with the last approved version. Look for new OCIDs, whole compartments,
Any {...}lists that grew, and missing tag conditions. - List the policy statements that name this dynamic group to see what its members can do.
- Identify the caller (data.identity.principalName, data.identity.ipAddress) and confirm the change with that person or pipeline.
- List the resources that now match the rule and check who can sign in to them or run commands on them.
- If not approved, restore the rule and review API calls made by instance or resource principals of the affected resources since the change.
Response
Once the attack is confirmed:
- Restore the approved matching rule, or delete the new dynamic group together with the policy statements that name it, so that the attacker's resource no longer inherits those rights.
- Treat every resource that matched the changed rule as compromised. Stop or isolate the instance or function the attacker controls, and find out who could sign in to it or run commands on it.
- Rotate what the policies of the dynamic group let the resource read, such as vault secrets, and undo what it changed.
- Contain the user or pipeline that changed the rule. Reset its credentials and remove its rights over dynamic groups until it is cleared.
- Compare the remaining dynamic groups and their policies with your infrastructure as code, and confirm that the restored rule matches only the intended resources.
Mitigation
- Grant
use dynamic-groupsandmanage dynamic-groupsonly to the identity team, and avoid tenancy-widemanage all-resourcesfor workload teams, which includes both. - Write matching rules for named instance or resource OCIDs, or for a defined tag that only administrators can apply, instead of whole compartments.
- Keep policies for dynamic groups narrow (named buckets, vault secrets or compartments) and review them together with the matching rules.
- Review the list of dynamic groups and their rules on a schedule and compare them with infrastructure as code.
Frequently asked questions
Does a new dynamic group give its members any rights by itself?
No. A new dynamic group gains rights only once a policy names it, so read the creation together with the policy changes around it. An update is different. Widening the matching rule of a dynamic group that already has strong policies takes effect without any policy change, and it needs only `use dynamic-groups`.
Will the rule fire when someone starts an instance in a compartment that a matching rule already covers?
No. A rule such as `instance.compartment.id = '<compartment_ocid>'` includes every instance that exists or is later created in that compartment, and the dynamic group itself is not changed when a new instance starts to match. That is why matching rules should name instance OCIDs, or a defined tag that only administrators can apply.
Why do I get alerts for changes that did not touch the matching rule?
Description-only updates use the same `UpdateDynamicGroup` operation as a change to the matching rule, and the rule on this page cannot tell them apart. Read the dynamic group named in `data.resourceName` and compare its matching rule with the last approved version before you close the alert.
Why do user access reviews miss this kind of access?
The principal is a resource, not a user. A matched instance or function calls OCI APIs with the rights of the dynamic group's policies and without any user credential. Oracle states that any user who can access an instance inherits the privileges granted to it, so a review has to include who can reach the matched resources.
References
- MITRE ATT&CK T1098.003: Additional Cloud Roles
- Oracle Cloud Infrastructure: Managing dynamic groups
- Oracle Cloud Infrastructure: Writing matching rules to define dynamic groups
- Oracle Cloud Infrastructure: Calling services from an instance (security considerations)
- Oracle Cloud Infrastructure: Services that produce events, IAM dynamic group event types
- Oracle Cloud Infrastructure: Contents of an Audit log event (data.identity, data.eventName)