Detection rules › Kusto

Dataverse - Login from IP in the block list

Status
available
Severity
high
Time window
1d
Group by
ClientIp, InstanceUrl, UserId
Source
github.com/Azure/Azure-Sentinel

Identifies Dataverse sign-in activity from IPv4 addresses which are on a predefined block list. Blocked network ranges are maintained in the NetworkAddresses watchlist template.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

id: 666fef96-1bb8-4abf-ad72-e5cb49561381
kind: Scheduled
name: Dataverse - Login from IP in the block list
description: Identifies Dataverse sign-in activity from IPv4 addresses which are on
  a predefined block list. Blocked network ranges are maintained in the NetworkAddresses
  watchlist template.
severity: High
status: Available
requiredDataConnectors:
  - connectorId: Dataverse
    dataTypes:
      - DataverseActivity
queryFrequency: 1h
queryPeriod: 1d
triggerOperator: gt
triggerThreshold: 0
tactics:
  - InitialAccess
relevantTechniques:
  - T1190
  - T1133
  - T1078
query: |
  // Use static IP address or CIDR list specified in the
  // NetworkAddresses watchlist (from watchlist template)
  // with tag "BlockDataverse"
  let query_frequency = 1h;
  let blocked_networks = MSBizAppsNetworkAddresses()
      | where Tags has "BlockDataverse"
      | summarize by IPSubnet;
  let watchlist_entries_count = toscalar (blocked_networks
      | summarize count());
  DataverseActivity
  | where watchlist_entries_count > 0
  | where TimeGenerated >= ago(query_frequency)
  | where Message == "UserSignIn" and isnotempty(ClientIp)
  | summarize FirstEvent = arg_min(TimeGenerated, *) by UserId, ClientIp, InstanceUrl
  | evaluate ipv4_lookup(blocked_networks, ClientIp, IPSubnet)
  | extend
      CloudAppId = int(32780),
      AccountName = tostring(split(UserId, '@')[0]),
      UPNSuffix = tostring(split(UserId, '@')[1])
  | project
      FirstEvent,
      UserId,
      ClientIp,
      Message,
      InstanceUrl,
      CloudAppId,
      AccountName,
      UPNSuffix
eventGroupingSettings:
  aggregationKind: AlertPerResult
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: Name
        columnName: AccountName
      - identifier: UPNSuffix
        columnName: UPNSuffix
  - entityType: IP
    fieldMappings:
      - identifier: Address
        columnName: ClientIp
  - entityType: CloudApplication
    fieldMappings:
      - identifier: AppId
        columnName: CloudAppId
      - identifier: InstanceName
        columnName: InstanceUrl
alertDetailsOverride:
  alertDisplayNameFormat: 'Dataverse - Login from IP in the block list at {{InstanceUrl}} '
  alertDescriptionFormat: Sign-in activity by {{UserId}} in {{InstanceUrl}} was detected
    from an IP {{ClientIp}} on the block list.
version: 3.2.0

Stages and Predicates

Parameters

let query_frequency = 1h;

Let binding: blocked_networks used in Stage 6

let blocked_networks = MSBizAppsNetworkAddresses()
    | where Tags has "BlockDataverse"
    | summarize by IPSubnet;

Let binding: watchlist_entries_count used in Stage 2

let watchlist_entries_count = toscalar (blocked_networks
    | summarize count());

Stage 1: source

DataverseActivity

Stage 2: where

| where watchlist_entries_count > 0

Stage 3: where

| where TimeGenerated >= ago(query_frequency)

Stage 4: where

| where Message == "UserSignIn" and isnotempty(ClientIp)

Stage 5: summarize

| summarize FirstEvent = arg_min(TimeGenerated, *) by UserId, ClientIp, InstanceUrl

Stage 6: evaluate

| evaluate ipv4_lookup(blocked_networks, ClientIp, IPSubnet)

Stage 7: extend

| extend
    CloudAppId = int(32780),
    AccountName = tostring(split(UserId, '@')[0]),
    UPNSuffix = tostring(split(UserId, '@')[1])

Stage 8: project

| project
    FirstEvent,
    UserId,
    ClientIp,
    Message,
    InstanceUrl,
    CloudAppId,
    AccountName,
    UPNSuffix

Indicators

These rows show field, operator, and value matches.

Output fields

These fields are emitted when the rule matches.

FieldSource
AccountNameproject
ClientIpproject
CloudAppIdproject
FirstEventproject
InstanceUrlproject
Messageproject
UPNSuffixproject
UserIdproject