Analyzing Cloud Identity & Access Risks, Hunting Control-Plane & Data Events, Containing Compromised Identities & Hardening
In cloud environments, identity permissions, trust relationships, and control-plane APIs often serve as the primary pivot points for attackers. Effective cloud defense pairs least-privilege identity design and short-lived credentials with close monitoring of control-plane and audit logs, followed by swift credential/session containment when anomalous actions occur.
| Focus Area | What to Check | Operational Guidance |
|---|---|---|
| Permission & Role Scope | Broad wildcard permissions, privilege escalation paths, or overly permissive trusts. | Grant only required actions/resources and review privileged assignments regularly. |
| Audit & Sign-In Telemetry | Control-plane mutations, identity/role changes, and unusual source IPs or clients. | Correlate actor, timestamp, source IP, and target resource across cloud logs. |
| Containment & Follow-Through | Compromised credentials, active sessions, or unauthorized resources created during an event. | Revoke/rotate affected credentials, inspect created assets/rules, and check adjacent accounts. |
AzureActivity
| where TimeGenerated > ago(24h)
| where OperationNameValue has_any ("/WRITE", "/DELETE", "/ACTION")
| summarize
Operations = count(),
DistinctOps = dcount(OperationNameValue),
SampleOps = make_set(OperationNameValue, 8)
by Caller, CallerIpAddress, ActivityStatusValue
| order by Operations desc
Caller CallerIpAddress ActivityStatusValue Operations DistinctOps SampleOps
------ --------------- ------------------- ---------- ----------- ---------
svc-deploy@corp.example 198.51.100.44 Succeeded 19 4 ["MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE",...]
SigninLogs
| where TimeGenerated > ago(24h)
| summarize
TotalSignIns = count(),
FailedSignIns = countif(ResultType != 0),
UniqueIPs = dcount(IPAddress),
SampleIPs = make_set(IPAddress, 8)
by UserPrincipalName
| where FailedSignIns >= 5 or UniqueIPs >= 4
| order by FailedSignIns desc, UniqueIPs desc
UserPrincipalName TotalSignIns FailedSignIns UniqueIPs SampleIPs
----------------- ------------ ------------- --------- ---------
r.kapoor@corp.example.com 14 9 5 ["203.0.113.10","198.51.100.84",...]
aws iam list-roles --query "Roles[].{RoleName:RoleName,CreateDate:CreateDate}" --output table
---------------------------------------------------------------------
| ListRoles |
+------------------------+------------------------------------------+
| CreateDate | RoleName |
+------------------------+------------------------------------------+
| 2026-06-12T08:15:00Z | SecurityAuditReadOnly |
| 2026-08-04T11:20:00Z | AppWorkloadRole-Prod |
+------------------------+------------------------------------------+
az role assignment list --query "[].{Principal:principalName,Role:roleDefinitionName,Scope:scope}" -o table
Principal Role Scope
------------------------- -------------- --------------------------------------
ops-deploy@corp.example Contributor /subscriptions/11111111-2222-3333-4444-555555555555
import json
policy = {
"Version": "2012-10-17",
"Statement": [
{"Effect": "Allow", "Action": "*", "Resource": "*"},
{"Effect": "Allow", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::app-bucket/*"},
],
}
for idx, stmt in enumerate(policy.get("Statement", [])):
if stmt.get("Effect") == "Allow" and (stmt.get("Action") == "*" or stmt.get("Resource") == "*"):
print(f"Broad allow in statement {idx}: Action={stmt.get('Action')} Resource={stmt.get('Resource')}")
Broad allow in statement 0: Action=* Resource=*
index=cloud_audit earliest=-24h
| stats count AS events dc(target_resource) AS targets values(action) AS actions
BY actor, src_ip
| where events >= 10
| sort -events
actor src_ip events targets actions
----- ------ ------ ------- -------
svc-deploy@corp.example 198.51.100.44 19 3 PutRolePolicy UpdateAssumeRolePolicy
SELECT
Pid,
Name,
Exe
FROM pslist()
WHERE Name =~ "(?i)^(aws|az|gcloud|python3|node)\\.exe$"
Pid Name Exe
--- ---- ---
4190 python3 /usr/bin/python3
80200
CreateAccessKey|PutRolePolicy|roleAssignments/write
Privileged cloud identity or policy action observed on $(agent.name)
** Alert 1795692104.44810: - local,cloud_iam,audit
2026 Nov 26 11:18:04 (cloud-audit-collector) 10.20.1.9->cloudtrail
Rule: 101201 (level 11) -> 'Privileged cloud identity or policy action observed on cloud-audit-collector'
ls -la "$HOME/.aws" "$HOME/.azure" "$HOME/.config/gcloud" 2>/dev/null || true
/home/devuser/.aws:
total 12
drwx------ 2 devuser devuser 4096 Nov 26 09:10 .
-rw------- 1 devuser devuser 184 Nov 26 09:10 config
from collections import Counter
actions = [
"roleAssignments/write",
"roleAssignments/write",
"securityGroups/write",
"policyAssignments/delete",
]
for act, cnt in Counter(actions).most_common():
print(f"{act}: {cnt}")
roleAssignments/write: 2
securityGroups/write: 1
policyAssignments/delete: 1
Select a cloud scenario below to review the triage steps and containment guidance: