AnalysisType: rule
RuleID: Wiz.User.Role.Updated.Or.Deleted
Description: This rule detects updates and deletions of Wiz user roles.
DisplayName: Wiz User Role Updated Or Deleted
Runbook: Verify that this change was planned. If not, revert the change and ensure this doesn't happen again. Review privileges given to accounts to ensure the principle of minimal privilege
Reference: https://www.wiz.io/blog/cloud-security-custom-roles-democratization
Enabled: true
Filename: wiz_user_role_updated_or_deleted.py
Severity: Medium
Reports:
MITRE ATT&CK:
- TA0003:T1098.001 # Account Manipulation
LogTypes:
- Wiz.Audit
DedupPeriodMinutes: 60
Threshold: 1
Tests:
- Name: DeleteUserRole
ExpectedResult: true
Log:
{
"id": "671d8e2d-1ca8-47eb-bf1c-d46cd3f0d737",
"action": "DeleteUserRole",
"requestId": "a83aba82-c707-4a2f-9761-fe9ee723b703",
"status": "SUCCESS",
"timestamp": "2024-07-31T18:09:28.790129Z",
"actionParameters": {
"input": {
"id": "b92c4032-9af8-4e2d-b6dc-3bf2005bb7ad"
},
"selection": [
"__typename",
"_stub"
]
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"sourceIP": "12.34.56.78",
"serviceAccount": null,
"user": {
"id": "test.user@company.com",
"name": "user@company.com"
}
}
- Name: CreateUser
ExpectedResult: false
Log:
{
"id": "220d23be-f07c-4d97-b4a6-87ad04eddb14",
"action": "CreateUser",
"requestId": "0d9521b2-c3f8-4a73-bf7c-20257788752e",
"status": "SUCCESS",
"timestamp": "2024-07-29T09:40:15.66643Z",
"actionParameters": {
"input": {
"assignedProjectIds": null,
"email": "testy@company.com",
"expiresAt": null,
"name": "Test User",
"role": "GLOBAL_ADMIN"
},
"selection": [
"__typename",
{
"user": [
"__typename",
"id"
]
}
]
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"sourceIP": "8.8.8.8",
"serviceAccount": null,
"user": {
"id": "someuser@company.com",
"name": "someuser@company.com"
}
}
- Name: DeleteUserRole - Fail
ExpectedResult: false
Log:
{
"id": "671d8e2d-1ca8-47eb-bf1c-d46cd3f0d737",
"action": "DeleteUserRole",
"requestId": "a83aba82-c707-4a2f-9761-fe9ee723b703",
"status": "FAILED",
"timestamp": "2024-07-31T18:09:28.790129Z",
"actionParameters": { },
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"sourceIP": "12.34.56.78",
"serviceAccount": null,
"user": {
"id": "test.user@company.com",
"name": "user@company.com"
}
}
# ------ paired body: wiz_user_role_updated_or_deleted.py ------
from panther_wiz_helpers import wiz_actor, wiz_alert_context, wiz_success
SUSPICIOUS_ACTIONS = ["DeleteUserRole", "UpdateUserRole"]
def rule(event):
if not wiz_success(event):
return False
return event.get("action", "ACTION_NOT_FOUND") in SUSPICIOUS_ACTIONS
def title(event):
actor = wiz_actor(event)
return (
f"[Wiz]: [{event.get('action', 'ACTION_NOT_FOUND')}] action "
f"performed by {actor.get('type')} [{actor.get('name')}]"
)
def dedup(event):
return event.get("id")
def alert_context(event):
return wiz_alert_context(event)
def severity(event):
action = event.get("action", "ACTION_NOT_FOUND")
if "Delete" in action:
return "High"
return "Default"