Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

4.8 KB
Raw Blame
id: chronicle-detection-rules-o365-entra-id-app-permissions-threshold-exceeded
name: o365_entra_id_app_permissions_threshold_exceeded
description: o365_entra_id_app_permissions_threshold_exceeded
severity: medium
enabled: false
tags:
  mitre: []
  categories:
  - endpoint
references: []
logsource:
  product: chronicle
detection:
  chronicle_yaral: "/*\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache\
    \ License, Version 2.0 (the \"License\");\n * you may not use this file except\
    \ in compliance with the License.\n * You may obtain a copy of the License at\n\
    \ *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required\
    \ by applicable law or agreed to in writing, software\n * distributed under the\
    \ License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS\
    \ OF ANY KIND, either express or implied.\n * See the License for the specific\
    \ language governing permissions and\n * limitations under the License.\n */\n\
    \nrule o365_entra_id_app_permissions_threshold_exceeded {\n\n  meta:\n    author\
    \ = \"Google Cloud Security\"\n    description = \"Detects when an excessive number\
    \ of permissions are assigned to an Entra ID application within a time window,\
    \ potentially indicating a greedy permission grab, as a numeric value comparing\
    \ old permissions to new permissions\"\n    rule_id = \"mr_8d1bb5a8-94cf-437c-9754-6046b4ca3549\"\
    \n    rule_name = \"O365 Entra ID App Permissions Threshold Exceeded\"\n    assumption\
    \ = \"This rule does not compare the specific permissions of the old and new permissions.\
    \ Removing 8 permissions and replacing with 8 different permissions would not\
    \ cause this rule to trigger\"\n    reference = \"https://learn.microsoft.com/en-us/graph/permissions-reference\"\
    \n    type = \"alert\"\n    platform = \"azure\"\n    data_source = \"o365\"\n\
    \    severity = \"Medium\"\n    priority = \"Medium\"\n\n  events:\n    $app.metadata.event_type\
    \ = \"USER_RESOURCE_UPDATE_CONTENT\"\n    $app.metadata.product_name = \"Office\
    \ 365\"\n    $app.metadata.product_event_type = \"Update application.\"\n    $app.metadata.vendor_name\
    \ = \"Microsoft\"\n    $app.security_result.action = \"ALLOW\"\n    (\n      $app.target.resource.attribute.labels.key\
    \ = /OldValue_EntitlementId-/ or\n      $app.target.resource.attribute.labels.key\
    \ = /NewValue_EntitlementId-/\n    )\n    $app.security_result.detection_fields[\"\
    target_1\"] = $app_name\n\n  match:\n    $app_name over 5m\n\n  outcome:\n   \
    \ $risk_score = 65\n    $event_count = count_distinct($app.metadata.id)\n    $security_summary\
    \ = array_distinct($app.security_result.summary)\n    $user_agent = array_distinct($app.network.http.user_agent)\n\
    \    $old_permissions = array_distinct(if($app.target.resource.attribute.labels.key\
    \ = /OldValue_EntitlementId-/, $app.target.resource.attribute.labels.value, \"\
    \"))\n    $new_permissions = array_distinct(if($app.target.resource.attribute.labels.key\
    \ = /NewValue_EntitlementId-/, $app.target.resource.attribute.labels.value, \"\
    \"))\n    /*\n    Apps created via the portal come with a permission of user.read,\
    \ however apps created via the Graph API do not. The first time permissions are\
    \ added to an app created via the API,\n    the distinct count for new permissions\
    \ will be off by one. Subsequent events will reflect the correct counts of old\
    \ and new permissions.\n    */\n    $old_permissions_count = count_distinct(if($app.target.resource.attribute.labels.key\
    \ = /OldValue_EntitlementId-/, $app.target.resource.attribute.labels.value, \"\
    \")) - 1\n    $new_permissions_count = count_distinct(if($app.target.resource.attribute.labels.key\
    \ = /NewValue_EntitlementId-/, $app.target.resource.attribute.labels.value, \"\
    \")) - 1\n    $zero_handler_old = if($old_permissions_count = 0, 1)\n    $permission_diff\
    \ = $new_permissions_count - $old_permissions_count\n    //added to populate alert\
    \ graph with additional context\n    $principal_user_userid = array_distinct($app.principal.user.userid)\n\
    \n  condition:\n    //Define your threshold for the number of permissions to be\
    \ exceeded to trigger\n    $app and $permission_diff > 8\n}"
  chronicle_rule_name: o365_entra_id_app_permissions_threshold_exceeded
provenance:
  source: chronicle/detection-rules
  source_id: o365_entra_id_app_permissions_threshold_exceeded
  source_commit: 74dd490
  license: Apache-2.0
  license_url: https://github.com/chronicle/detection-rules/blob/main/LICENSE
  imported_at: '2026-05-04'
  imported_by: chronicle_importer
  upstream_path: rules/community/microsoft/o365/o365_entra_id_app_permissions_threshold_exceeded.yaral
notes:
  chronicle_meta: {}
  quarantine_reason: raw YARA-L — needs translation to AiSOC schema