Detection rules › YARA-L
Office 365 Teams member removed
Detects when a user is removed from a group in Microsoft Teams.
Telemetry coverage
| Platform | Record / event type |
|---|---|
| Microsoft 365 | MemberRemoved |
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_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
}
YARA-L rule structure
Condition
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"
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($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) |