Detection rules › YARA-L
Office 365 group modification add member success has exceeded a defined threshold
Detects when a group GUID in Office 365 has more users added to it by the same user than a defined thresold.
Telemetry coverage
| Platform | Record / event type |
|---|---|
| Microsoft 365 | Add member to group. |
Rules detecting the same action
These rules filter on the same operation.
Rule body
// Copyright 2025 Google LLC. Licensed under Apache-2.0.
rule o365_group_modification_add_member_success_threshold {
meta:
author = "Google Cloud Security"
description = "Detects when a group GUID in Office 365 has more users added to it by the same user than a defined thresold."
rule_id = "mr_47e13870-800b-4886-b8b8-8e6b68b203b9"
rule_name = "Office 365 group modification add member success has exceeded a defined threshold"
type = "alert"
platform = "azure"
data_source = "o365"
severity = "Low"
priority = "Low"
events:
$group.metadata.event_type = "GROUP_MODIFICATION"
$group.metadata.product_event_type = "Add member to group."
$group.metadata.product_name = "Office 365"
$group.metadata.vendor_name = "Microsoft"
$group.security_result.action = "ALLOW"
$group.principal.user.userid = $user
$group.target.group.product_object_id = $guid
match:
$guid, $user over 5m
outcome:
$risk_score = 35
$event_count = count_distinct($group.metadata.id)
$user_agent = array_distinct($group.network.http.user_agent)
$security_summary = array_distinct($group.security_result.summary)
$target_application = array_distinct($group.target.application)
$principal_user_userid = array_distinct($group.principal.user.userid)
$group_name = array_distinct($group.target.group.group_display_name)
$group_guid = array_distinct($group.target.group.product_object_id)
$user_added = array_distinct($group.target.user.userid)
$user_count = count_distinct($group.target.user.userid)
condition:
//Modify the user_count value to suit your needs
$group and $user_count > 4
}
YARA-L rule structure
Condition
Fires when at least one $group event in the 5m window and $user_count > 4.
Events
$group
metadata.product_event_type = "Add member to group."security_result.action = "ALLOW"
Match and correlation
Outcome
Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.
| Field | Expression |
|---|---|
risk_score | 35 |
event_count | count_distinct($group.metadata.id) |
user_agent | array_distinct($group.network.http.user_agent) |
security_summary | array_distinct($group.security_result.summary) |
target_application | array_distinct($group.target.application) |
principal_user_userid | array_distinct($group.principal.user.userid) |
group_name | array_distinct($group.target.group.group_display_name) |
group_guid | array_distinct($group.target.group.product_object_id) |
user_added | array_distinct($group.target.user.userid) |
user_count | count_distinct($group.target.user.userid) |