Detection rules › YARA-L

O365 Entra ID Application Creation

Severity
low
Type
alert
Time window
5m
Match by
user_or_resource
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Application creation is a legitimate activity but doesn't occur frequently. Alerts when a new application is created in Entra ID (formerly Azure AD).

Event coverage

Rules detecting the same action

Other rules on this platform that filter on the same API call or operation.

Rule body yaral

/*
 * Copyright 2023 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_entra_id_application_creation {

  meta:
    author = "Google Cloud Security"
    description = "Application creation is a legitimate activity but doesn't occur frequently. Alerts when a new application is created in Entra ID (formerly Azure AD)."
    rule_id = "mr_c8daf9ab-2b39-46cc-bda9-7fd1ebb13a81"
    rule_name = "O365 Entra ID Application Creation"
    type = "alert"
    platform = "azure"
    data_source = "o365"
    severity = "Low"
    priority = "Medium"

  events:
    $app.metadata.event_type = "USER_RESOURCE_CREATION"
    $app.metadata.product_name = "Office 365"
    $app.metadata.vendor_name = "Microsoft"
    $app.metadata.product_event_type = "Add application."
    $app.security_result.action = "ALLOW"
    //These events should have a userid associated with them but in case they don't we will match on the app name being created instead
    strings.coalesce($app.principal.user.userid, $app.target.resource.name) = $user_or_resource

  match:
    $user_or_resource over 5m

  outcome:
    $risk_score = 35
    $event_count = count_distinct($app.metadata.id)
    $target_application = array_distinct($app.target.application)
    $security_summary = array_distinct($app.security_result.summary)
    $user_agent = array_distinct($app.network.http.user_agent)
    //added to populate alert graph with additional context
    $principal_user_userid = array_distinct($app.principal.user.userid)
    $target_resource_name = array_distinct($app.target.resource.name)

  condition:
    $app
}

Detection logic

Fires when at least one $app event in the 5m window.

Events

$app USER_RESOURCE_CREATION

  • metadata.product_event_type = "Add application."
  • security_result.action = "ALLOW"

$strings.coalesce()

No field filters (binds the event for correlation only).

Correlation

Match key
$user_or_resource
Within
5m

Outcome

Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.

FieldExpression
risk_score35
event_countcount_distinct($app.metadata.id)
target_applicationarray_distinct($app.target.application)
security_summaryarray_distinct($app.security_result.summary)
user_agentarray_distinct($app.network.http.user_agent)
principal_user_useridarray_distinct($app.principal.user.userid)
target_resource_namearray_distinct($app.target.resource.name)