Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Lumen TI IPAddress in IdentityLogonEvents

Back
Ida7cd18cd-1503-47ec-8dca-65d750540637
RulenameLumen TI IPAddress in IdentityLogonEvents
DescriptionThis query maps Lumen IP indicators of compromise (IOCs) from threat intelligence (TI), by searching for matches in Azure AD sign-in logs.
SeverityMedium
TacticsCommandAndControl
TechniquesT1071
Required data connectorsAzureActiveDirectory
LumenThreatFeedConnector
ThreatIntelligenceUploadIndicatorsAPI
KindScheduled
Query frequency4h
Query period14d
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Lumen Defender Threat Feed/Analytic Rules/Lumen_IPEntity_IdentityLogonEvents.yaml
Version1.0.2
Arm templatea7cd18cd-1503-47ec-8dca-65d750540637.json
Deploy To Azure
let dt_lookBack = 1d;  // Data lookback for AAD sign-in logs
let ioc_lookBack = 14d; // TI lookback
let IP_Indicators =
    ThreatIntelIndicators
    | where TimeGenerated >= ago(ioc_lookBack)
    | where IsActive == true and ValidUntil > now()
    | summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by Id
    | where SourceSystem == 'Lumen'
    | where ObservableKey == 'ipv4-addr:value'
    | extend TI_ipEntity = ObservableValue
    | where ipv4_is_private(TI_ipEntity) == false and TI_ipEntity !startswith 'fe80' and TI_ipEntity !startswith '::' and TI_ipEntity !startswith '127.';
let SignInUnion =
    union isfuzzy=true
    (
        AADNonInteractiveUserSignInLogs
        | where TimeGenerated >= ago(dt_lookBack)
        | extend
            ILE_ipEntity = IPAddress,
            AccountDisplayName = coalesce(UserDisplayName, UserPrincipalName),
            Application = coalesce(column_ifexists('AppDisplayName',''), column_ifexists('ResourceDisplayName','')),
            LogonType = column_ifexists('ClientAppUsed',''),
            IdentityLogonEvents_TimeGenerated = TimeGenerated
        | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type
    ),
    (
        AADServicePrincipalSignInLogs
        | where TimeGenerated >= ago(dt_lookBack)
        | extend
            ILE_ipEntity = IPAddress,
            AccountDisplayName = coalesce(ServicePrincipalName, tostring(ServicePrincipalId)),
            Application = coalesce(column_ifexists('AppDisplayName',''), column_ifexists('ResourceDisplayName','')),
            LogonType = "ServicePrincipal",
            IdentityLogonEvents_TimeGenerated = TimeGenerated
        | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type
    ),
    (
        AADManagedIdentitySignInLogs
        | where TimeGenerated >= ago(dt_lookBack)
        | extend
            ILE_ipEntity = IPAddress,
            AccountDisplayName = coalesce(ServicePrincipalName, tostring(ServicePrincipalId)),
            Application = ResourceDisplayName,
            LogonType = "ManagedIdentity",
            IdentityLogonEvents_TimeGenerated = TimeGenerated
        | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type
    ),
    (
        ADFSSignInLogs
        | where TimeGenerated >= ago(dt_lookBack)
        | extend
            ILE_ipEntity = IPAddress,
            AccountDisplayName = coalesce(UserDisplayName, UserPrincipalName),
            Application = coalesce(AppDisplayName, ResourceDisplayName),
            LogonType = coalesce(Requirement, AuthenticationRequirement),
            IdentityLogonEvents_TimeGenerated = TimeGenerated
        | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type
    );
IP_Indicators
| join kind=innerunique (SignInUnion) on $left.TI_ipEntity == $right.ILE_ipEntity
| where IdentityLogonEvents_TimeGenerated < ValidUntil
| summarize arg_max(IdentityLogonEvents_TimeGenerated, *), StartTime = min(IdentityLogonEvents_TimeGenerated), EndTime = max(IdentityLogonEvents_TimeGenerated) by Id, ILE_ipEntity
| project timestamp = EndTime, StartTime, EndTime, AccountDisplayName, IPAddress, Application, LogonType, Id, Tags, ValidUntil, Confidence, TI_ipEntity, ILE_ipEntity, Type
requiredDataConnectors:
- dataTypes:
  - ThreatIntelligenceIndicator
  connectorId: LumenThreatFeedConnector
- dataTypes:
  - ThreatIntelligenceIndicator
  connectorId: ThreatIntelligenceUploadIndicatorsAPI
- dataTypes:
  - AADNonInteractiveUserSignInLogs
  - AADServicePrincipalSignInLogs
  - AADManagedIdentitySignInLogs
  - ADFSSignInLogs
  connectorId: AzureActiveDirectory
severity: Medium
kind: Scheduled
name: Lumen TI IPAddress in IdentityLogonEvents
id: a7cd18cd-1503-47ec-8dca-65d750540637
query: |
  let dt_lookBack = 1d;  // Data lookback for AAD sign-in logs
  let ioc_lookBack = 14d; // TI lookback
  let IP_Indicators =
      ThreatIntelIndicators
      | where TimeGenerated >= ago(ioc_lookBack)
      | where IsActive == true and ValidUntil > now()
      | summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by Id
      | where SourceSystem == 'Lumen'
      | where ObservableKey == 'ipv4-addr:value'
      | extend TI_ipEntity = ObservableValue
      | where ipv4_is_private(TI_ipEntity) == false and TI_ipEntity !startswith 'fe80' and TI_ipEntity !startswith '::' and TI_ipEntity !startswith '127.';
  let SignInUnion =
      union isfuzzy=true
      (
          AADNonInteractiveUserSignInLogs
          | where TimeGenerated >= ago(dt_lookBack)
          | extend
              ILE_ipEntity = IPAddress,
              AccountDisplayName = coalesce(UserDisplayName, UserPrincipalName),
              Application = coalesce(column_ifexists('AppDisplayName',''), column_ifexists('ResourceDisplayName','')),
              LogonType = column_ifexists('ClientAppUsed',''),
              IdentityLogonEvents_TimeGenerated = TimeGenerated
          | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type
      ),
      (
          AADServicePrincipalSignInLogs
          | where TimeGenerated >= ago(dt_lookBack)
          | extend
              ILE_ipEntity = IPAddress,
              AccountDisplayName = coalesce(ServicePrincipalName, tostring(ServicePrincipalId)),
              Application = coalesce(column_ifexists('AppDisplayName',''), column_ifexists('ResourceDisplayName','')),
              LogonType = "ServicePrincipal",
              IdentityLogonEvents_TimeGenerated = TimeGenerated
          | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type
      ),
      (
          AADManagedIdentitySignInLogs
          | where TimeGenerated >= ago(dt_lookBack)
          | extend
              ILE_ipEntity = IPAddress,
              AccountDisplayName = coalesce(ServicePrincipalName, tostring(ServicePrincipalId)),
              Application = ResourceDisplayName,
              LogonType = "ManagedIdentity",
              IdentityLogonEvents_TimeGenerated = TimeGenerated
          | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type
      ),
      (
          ADFSSignInLogs
          | where TimeGenerated >= ago(dt_lookBack)
          | extend
              ILE_ipEntity = IPAddress,
              AccountDisplayName = coalesce(UserDisplayName, UserPrincipalName),
              Application = coalesce(AppDisplayName, ResourceDisplayName),
              LogonType = coalesce(Requirement, AuthenticationRequirement),
              IdentityLogonEvents_TimeGenerated = TimeGenerated
          | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type
      );
  IP_Indicators
  | join kind=innerunique (SignInUnion) on $left.TI_ipEntity == $right.ILE_ipEntity
  | where IdentityLogonEvents_TimeGenerated < ValidUntil
  | summarize arg_max(IdentityLogonEvents_TimeGenerated, *), StartTime = min(IdentityLogonEvents_TimeGenerated), EndTime = max(IdentityLogonEvents_TimeGenerated) by Id, ILE_ipEntity
  | project timestamp = EndTime, StartTime, EndTime, AccountDisplayName, IPAddress, Application, LogonType, Id, Tags, ValidUntil, Confidence, TI_ipEntity, ILE_ipEntity, Type  
queryPeriod: 14d
displayName: Lumen TI IPAddress in IdentityLogonEvents
relevantTechniques:
- T1071
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Lumen Defender Threat Feed/Analytic Rules/Lumen_IPEntity_IdentityLogonEvents.yaml
description: |
    This query maps Lumen IP indicators of compromise (IOCs) from threat intelligence (TI), by searching for matches in Azure AD sign-in logs.
version: 1.0.2
suppressionEnabled: true
entityMappings:
- fieldMappings:
  - columnName: ILE_ipEntity
    identifier: Address
  entityType: IP
queryFrequency: 4h
triggerOperator: gt
tactics:
- CommandAndControl
triggerThreshold: 0
suppressionDuration: 5h
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2024-01-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/a7cd18cd-1503-47ec-8dca-65d750540637')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/a7cd18cd-1503-47ec-8dca-65d750540637')]",
      "properties": {
        "alertRuleTemplateName": "a7cd18cd-1503-47ec-8dca-65d750540637",
        "customDetails": null,
        "description": "This query maps Lumen IP indicators of compromise (IOCs) from threat intelligence (TI), by searching for matches in Azure AD sign-in logs.\n",
        "displayName": "Lumen TI IPAddress in IdentityLogonEvents",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "ILE_ipEntity",
                "identifier": "Address"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Lumen Defender Threat Feed/Analytic Rules/Lumen_IPEntity_IdentityLogonEvents.yaml",
        "query": "let dt_lookBack = 1d;  // Data lookback for AAD sign-in logs\nlet ioc_lookBack = 14d; // TI lookback\nlet IP_Indicators =\n    ThreatIntelIndicators\n    | where TimeGenerated >= ago(ioc_lookBack)\n    | where IsActive == true and ValidUntil > now()\n    | summarize LatestIndicatorTime = arg_max(TimeGenerated, *) by Id\n    | where SourceSystem == 'Lumen'\n    | where ObservableKey == 'ipv4-addr:value'\n    | extend TI_ipEntity = ObservableValue\n    | where ipv4_is_private(TI_ipEntity) == false and TI_ipEntity !startswith 'fe80' and TI_ipEntity !startswith '::' and TI_ipEntity !startswith '127.';\nlet SignInUnion =\n    union isfuzzy=true\n    (\n        AADNonInteractiveUserSignInLogs\n        | where TimeGenerated >= ago(dt_lookBack)\n        | extend\n            ILE_ipEntity = IPAddress,\n            AccountDisplayName = coalesce(UserDisplayName, UserPrincipalName),\n            Application = coalesce(column_ifexists('AppDisplayName',''), column_ifexists('ResourceDisplayName','')),\n            LogonType = column_ifexists('ClientAppUsed',''),\n            IdentityLogonEvents_TimeGenerated = TimeGenerated\n        | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type\n    ),\n    (\n        AADServicePrincipalSignInLogs\n        | where TimeGenerated >= ago(dt_lookBack)\n        | extend\n            ILE_ipEntity = IPAddress,\n            AccountDisplayName = coalesce(ServicePrincipalName, tostring(ServicePrincipalId)),\n            Application = coalesce(column_ifexists('AppDisplayName',''), column_ifexists('ResourceDisplayName','')),\n            LogonType = \"ServicePrincipal\",\n            IdentityLogonEvents_TimeGenerated = TimeGenerated\n        | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type\n    ),\n    (\n        AADManagedIdentitySignInLogs\n        | where TimeGenerated >= ago(dt_lookBack)\n        | extend\n            ILE_ipEntity = IPAddress,\n            AccountDisplayName = coalesce(ServicePrincipalName, tostring(ServicePrincipalId)),\n            Application = ResourceDisplayName,\n            LogonType = \"ManagedIdentity\",\n            IdentityLogonEvents_TimeGenerated = TimeGenerated\n        | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type\n    ),\n    (\n        ADFSSignInLogs\n        | where TimeGenerated >= ago(dt_lookBack)\n        | extend\n            ILE_ipEntity = IPAddress,\n            AccountDisplayName = coalesce(UserDisplayName, UserPrincipalName),\n            Application = coalesce(AppDisplayName, ResourceDisplayName),\n            LogonType = coalesce(Requirement, AuthenticationRequirement),\n            IdentityLogonEvents_TimeGenerated = TimeGenerated\n        | project IdentityLogonEvents_TimeGenerated, ILE_ipEntity, AccountDisplayName, Application, LogonType, IPAddress, Type\n    );\nIP_Indicators\n| join kind=innerunique (SignInUnion) on $left.TI_ipEntity == $right.ILE_ipEntity\n| where IdentityLogonEvents_TimeGenerated < ValidUntil\n| summarize arg_max(IdentityLogonEvents_TimeGenerated, *), StartTime = min(IdentityLogonEvents_TimeGenerated), EndTime = max(IdentityLogonEvents_TimeGenerated) by Id, ILE_ipEntity\n| project timestamp = EndTime, StartTime, EndTime, AccountDisplayName, IPAddress, Application, LogonType, Id, Tags, ValidUntil, Confidence, TI_ipEntity, ILE_ipEntity, Type\n",
        "queryFrequency": "PT4H",
        "queryPeriod": "P14D",
        "severity": "Medium",
        "subTechniques": [],
        "suppressionDuration": "PT5H",
        "suppressionEnabled": true,
        "tactics": [
          "CommandAndControl"
        ],
        "techniques": [
          "T1071"
        ],
        "templateVersion": "1.0.2",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}