o365_admin_login_activity_to_uncommon_mscloud_apps


Description

This rule detects O365 login activity to apps other than a defined list of first party MS Cloud Apps. Note that Azure Active Directory PowerShell and custom Azure apps are not in this list by default

Query · yara_l

events:
    $login.metadata.event_type = "USER_LOGIN"
    $login.metadata.product_event_type = "UserLoggedIn"
    $login.metadata.product_name = "Office 365"
    NOT $login.target.resource.product_object_id in %first_party_ms_cloud_apps
    $login.metadata.vendor_name = "Microsoft"
    $login.security_result.action = "ALLOW"
    $login.target.user.userid = $userid

    //Use the criteria below if you want to isolate activity to a specific watchlist of users
    //@domain.com is stripped off to reduce the values in the list to just the username of the email address, can apply to userid or email address fields
    re.replace($login.target.user.userid, `@.*$`, "")  in %msazure_admin_watchlist

  match:
    $userid over 5m

  outcome:
    $risk_score = 65
    $event_count = count_distinct($login.metadata.id)
    $target_application = array_distinct($login.target.resource.product_object_id)
    $security_summary = array_distinct($login.security_result.summary)
    $user_agent = array_distinct($login.network.http.user_agent)
    $country_region_login_attempt = array_distinct($login.principal.ip_geo_artifact.location.country_or_region)
    //added to populate alert graph with additional context
    $principal_ip = array_distinct($login.principal.ip)
    $target_user_userid = array_distinct($login.target.user.userid)

  condition:
    $login
Raw source o365_admin_login_activity_to_uncommon_mscloud_apps · YARA-L
Esc
Published by chronicle/detection-rules ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
rule o365_admin_login_activity_to_uncommon_mscloud_apps {

  meta:
    author = "Google Cloud Security"
    description = "This rule detects O365 login activity to apps other than a defined list of first party MS Cloud Apps. Note that Azure Active Directory PowerShell and custom Azure apps are not in this list by default"
    rule_id = "mr_4fa166c8-922a-4dc1-b72d-9bcb2ec7609f"
    rule_name = "O365 Admin Login Activity To Uncommon Microsoft Cloud Apps"
    assumption = "The lists first_party_ms_cloud_apps and msazure_admin_watchlist are populated as needed"
    tactic = "TA0001"
    technique = "T1078.004"
    reference = "https://learn.microsoft.com/en-us/troubleshoot/azure/active-directory/verify-first-party-apps-sign-in"
    type = "alert"
    platform = "azure"
    data_source = "o365"
    severity = "High"
    priority = "High"

  events:
    $login.metadata.event_type = "USER_LOGIN"
    $login.metadata.product_event_type = "UserLoggedIn"
    $login.metadata.product_name = "Office 365"
    NOT $login.target.resource.product_object_id in %first_party_ms_cloud_apps
    $login.metadata.vendor_name = "Microsoft"
    $login.security_result.action = "ALLOW"
    $login.target.user.userid = $userid

    //Use the criteria below if you want to isolate activity to a specific watchlist of users
    //@domain.com is stripped off to reduce the values in the list to just the username of the email address, can apply to userid or email address fields
    re.replace($login.target.user.userid, `@.*$`, "")  in %msazure_admin_watchlist

  match:
    $userid over 5m

  outcome:
    $risk_score = 65
    $event_count = count_distinct($login.metadata.id)
    $target_application = array_distinct($login.target.resource.product_object_id)
    $security_summary = array_distinct($login.security_result.summary)
    $user_agent = array_distinct($login.network.http.user_agent)
    $country_region_login_attempt = array_distinct($login.principal.ip_geo_artifact.location.country_or_region)
    //added to populate alert graph with additional context
    $principal_ip = array_distinct($login.principal.ip)
    $target_user_userid = array_distinct($login.target.user.userid)

  condition:
    $login
}

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.