Detection rules › YARA-L
Office 365 Teams member removed
Detects when a user is removed from a group in Microsoft Teams.
Event coverage
| Provider | Event |
|---|---|
| M365-MicrosoftTeams | MemberRemoved |
Rule body yaral
/*
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
rule o365_teams_member_removed {
meta:
author = "Google Cloud Security"
description = "Detects when a user is removed from a group in Microsoft Teams."
rule_id = "mr_9cbf9cc6-35ae-44bd-8c2c-3ed4f8ea528f"
rule_name = "Office 365 Teams member removed"
type = "alert"
platform = "azure"
data_source = "o365"
severity = "Low"
priority = "Low"
events:
$app.metadata.product_name = "Office 365"
$app.metadata.vendor_name = "Microsoft"
$app.metadata.log_type = "OFFICE_365"
$app.metadata.product_event_type = "MemberRemoved"
$app.about.user.user_display_name = $userid
$app.target.application = "MicrosoftTeams"
$app.metadata.event_type = "USER_CHANGE_PERMISSIONS"
$app.security_result.action = "UNKNOWN_ACTION"
match:
$userid over 5m
outcome:
$risk_score = 35
$event_count = count_distinct($app.metadata.id)
$target_application = array_distinct($app.target.application)
$principal_user_userid = array_distinct($app.principal.user.userid)
$group_name = array_distinct($app.target.group.group_display_name)
$group_id = array_distinct($app.target.group.product_object_id)
$removed_user_email = array_distinct($app.about.user.email_addresses)
$removed_user_name = array_distinct($app.about.user.user_display_name)
condition:
$app
}
Detection logic
Fires when at least one $app event in the 5m window.
Events
$app
metadata.log_type = "OFFICE_365"metadata.product_event_type = "MemberRemoved"target.application = "MicrosoftTeams"security_result.action = "UNKNOWN_ACTION"
Correlation
Outcome
Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.
| Field | Expression |
|---|---|
risk_score | 35 |
event_count | count_distinct($app.metadata.id) |
target_application | array_distinct($app.target.application) |
principal_user_userid | array_distinct($app.principal.user.userid) |
group_name | array_distinct($app.target.group.group_display_name) |
group_id | array_distinct($app.target.group.product_object_id) |
removed_user_email | array_distinct($app.about.user.email_addresses) |
removed_user_name | array_distinct($app.about.user.user_display_name) |