Microsoft Sentinel medium experimental kql

GreyNoise TI map IP entity to Network Session Events (ASIM Network Session schema)

'This rule identifies a match Network Sessions for which the source or destination IP address is a known GreyNoise IoC. This analytic rule uses [ASIM](https://aka.ms/AboutASIM) and supports any built-in or custom source that supports the ASIM NetworkSession schema'

View Source

Detection Logic

let dt_lookBack = 1h;
let ioc_lookBack = 14d;
// Fetch GreyNoise IPv4 indicators from the ThreatIntelIndicators (STIX 2.1) table.
// GreyNoise only publishes ipv4-addr patterns, so a single ObservableKey filter is sufficient.
let IP_TI = materialize (
  ThreatIntelIndicators
| where TimeGenerated >= ago(ioc_lookBack)
| where SourceSystem == 'GreyNoise'
| where ObservableKey == 'ipv4-addr:value'
  // Take the latest row per indicator first, then evaluate its current state, so an
  // indicator that has since been deactivated cannot be resurrected by an older row.
| summarize arg_max(TimeGenerated, *) by Id
| where IsActive == true and IsDeleted == false and ValidUntil > now()
| extend TI_ipEntity = ObservableValue
| where isnotempty(TI_ipEntity)
  // Explicit projection keeps TimeGenerated and Type off the left side of the join, avoiding column collisions.
  // IsActive is retained because the lookups below use it as the match flag.
| project IndicatorId = Id, TI_ipEntity, IsActive, ThreatType = tostring(Data.indicator_types[0]), IoCDescription = tostring(Data.description), Tags, Confidence, ValidFrom, ValidUntil
);
IP_TI
  // using innerunique to keep perf fast and result set low, we only need one match to indicate potential malicious activity that needs to be investigated
| join kind=innerunique
(
  _Im_NetworkSession (starttime=ago(dt_lookBack))
| where isnotempty(SrcIpAddr)
| summarize imNWS_mintime=min(TimeGenerated), imNWS_maxtime=max(TimeGenerated) by SrcIpAddr, DstIpAddr, Dvc, EventProduct, EventVendor
| lookup (IP_TI
| project TI_ipEntity, IsActive) on $left.SrcIpAddr == $right.TI_ipEntity
| project-rename SrcMatch = IsActive
| lookup (IP_TI
| project TI_ipEntity, IsActive) on $left.DstIpAddr == $right.TI_ipEntity
| project-rename DstMatch = IsActive
| where SrcMatch or DstMatch
| extend
      IoCIP = iff(SrcMatch, SrcIpAddr, DstIpAddr),
      IoCDirection = iff(SrcMatch, "Source", "Destination")
)on $left.TI_ipEntity == $right.IoCIP
| where imNWS_mintime < ValidUntil
| project imNWS_mintime, imNWS_maxtime, IoCDescription, IndicatorId, ThreatType, ValidFrom, ValidUntil, Confidence, Tags, SrcIpAddr, DstIpAddr, IoCDirection, IoCIP, Dvc, EventVendor, EventProduct

Field Validations

Loading…

Comments (0)

Loading comments...