DET-174 · agent · confidence High
Agent Identities Changing Permissions
Alert when an identity tagged as an agent changes IAM, RBAC or sharing, especially on itself.
Agents that grant themselves access leave a clear record: the caller and the target principal are the same, or the target is another agent role. Tagging agent roles and service principals makes this a simple filter on IAM and RBAC change events.
Agent roles should rarely change IAM. Where they must, route changes through a plan and approval step so ad hoc calls stand out. Self-targeted changes, where caller and target match, should page and be rolled back automatically if the change has no linked approval.
- Data sources
- AWS CloudTrailAzure Activity LogGCP Cloud Audit LogsKubernetes audit logs
- Platforms
- AWSAzureGCPAI Platform
Logic
index=cloudtrail eventSource=iam.amazonaws.com eventName IN (AttachRolePolicy, PutRolePolicy, UpdateAssumeRolePolicy, CreateRole, CreateUser, CreateAccessKey, AddUserToGroup) | lookup agent_roles.csv arn AS userIdentity.sessionContext.sessionIssuer.arn OUTPUT agent | where agent="true" | eval self=if(requestParameters.roleName=userIdentity.sessionContext.sessionIssuer.userName, 1, 0) // K8s: verb in (create, patch) on clusterrolebindings/rolebindings where user.username startswith "system:serviceaccount:agents:"
False positives
Infrastructure agents whose job is to manage IAM through reviewed plans.