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

GSA - Detect Abnormal Deny Rate for Source to Destination IP

Back
Ide3b6a9e7-4c3a-45e6-8baf-1d3bfa8e0c2b
RulenameGSA - Detect Abnormal Deny Rate for Source to Destination IP
DescriptionIdentifies abnormal deny rate for specific source IP to destination IP based on the normal average and standard deviation learned during a configured period. This can indicate potential exfiltration, initial access, or C2, where an attacker tries to exploit the same vulnerability on machines in the organization but is being blocked by firewall rules.



Configurable Parameters:

- minimumOfStdsThreshold: The number of stds to use in the threshold calculation. Default is set to 3.

- learningPeriodTime: Learning period for threshold calculation in days. Default is set to 5.

- binTime: Learning buckets time in hours. Default is set to 1 hour.

- minimumThreshold: Minimum threshold for alert. Default is set to 5.

- minimumBucketThreshold: Minimum learning buckets threshold for alert. Default is set to 5.
SeverityMedium
TacticsInitialAccess
Exfiltration
CommandAndControl
TechniquesT1571
Required data connectorsAzureActiveDirectory
KindScheduled
Query frequency1h
Query period25h
Trigger threshold1
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Global Secure Access/Analytic Rules/SWG - Abnormal Deny Rate.yaml
Version1.0.3
Arm templatee3b6a9e7-4c3a-45e6-8baf-1d3bfa8e0c2b.json
Deploy To Azure
let NumOfStdsThreshold = 3;
let LearningPeriod = 5d;
let BinTime = 1h;
let MinThreshold = 5.0;
let MinLearningBuckets = 5;
let TrafficLogs = NetworkAccessTraffic
  | where Action == "Denied"
  | where isnotempty(DestinationIp) and isnotempty(SourceIp);
let LearningSrcIpDenyRate = TrafficLogs
  | where TimeGenerated between (ago(LearningPeriod + 1d) .. ago(1d))
  | summarize count_ = count() by SourceIp, bin(TimeGenerated, BinTime), DestinationIp
  | summarize LearningTimeSrcIpDenyRateAvg = avg(count_), LearningTimeSrcIpDenyRateStd = stdev(count_), LearningTimeBuckets = count() by SourceIp, DestinationIp
  | where LearningTimeBuckets > MinLearningBuckets;
let AlertTimeSrcIpDenyRate = TrafficLogs
  | where TimeGenerated between (ago(1h) .. now())
  | summarize AlertTimeSrcIpDenyRateCount = count() by SourceIp, DestinationIp;
AlertTimeSrcIpDenyRate
  | join kind=leftouter (LearningSrcIpDenyRate) on SourceIp, DestinationIp
  | extend LearningThreshold = max_of(LearningTimeSrcIpDenyRateAvg + NumOfStdsThreshold * LearningTimeSrcIpDenyRateStd, MinThreshold)
  | where AlertTimeSrcIpDenyRateCount > LearningThreshold
  | project SourceIp, DestinationIp, AlertTimeSrcIpDenyRateCount, LearningThreshold
tactics:
- InitialAccess
- Exfiltration
- CommandAndControl
triggerOperator: gt
queryPeriod: 25h
queryFrequency: 1h
requiredDataConnectors:
- dataTypes:
  - NetworkAccessTrafficLogs
  connectorId: AzureActiveDirectory
status: Available
id: e3b6a9e7-4c3a-45e6-8baf-1d3bfa8e0c2b
relevantTechniques:
- T1571
triggerThreshold: 1
kind: Scheduled
entityMappings:
- fieldMappings:
  - identifier: Address
    columnName: SourceIp
  entityType: IP
- fieldMappings:
  - identifier: Url
    columnName: DestinationIp
  entityType: URL
query: |
  let NumOfStdsThreshold = 3;
  let LearningPeriod = 5d;
  let BinTime = 1h;
  let MinThreshold = 5.0;
  let MinLearningBuckets = 5;
  let TrafficLogs = NetworkAccessTraffic
    | where Action == "Denied"
    | where isnotempty(DestinationIp) and isnotempty(SourceIp);
  let LearningSrcIpDenyRate = TrafficLogs
    | where TimeGenerated between (ago(LearningPeriod + 1d) .. ago(1d))
    | summarize count_ = count() by SourceIp, bin(TimeGenerated, BinTime), DestinationIp
    | summarize LearningTimeSrcIpDenyRateAvg = avg(count_), LearningTimeSrcIpDenyRateStd = stdev(count_), LearningTimeBuckets = count() by SourceIp, DestinationIp
    | where LearningTimeBuckets > MinLearningBuckets;
  let AlertTimeSrcIpDenyRate = TrafficLogs
    | where TimeGenerated between (ago(1h) .. now())
    | summarize AlertTimeSrcIpDenyRateCount = count() by SourceIp, DestinationIp;
  AlertTimeSrcIpDenyRate
    | join kind=leftouter (LearningSrcIpDenyRate) on SourceIp, DestinationIp
    | extend LearningThreshold = max_of(LearningTimeSrcIpDenyRateAvg + NumOfStdsThreshold * LearningTimeSrcIpDenyRateStd, MinThreshold)
    | where AlertTimeSrcIpDenyRateCount > LearningThreshold
    | project SourceIp, DestinationIp, AlertTimeSrcIpDenyRateCount, LearningThreshold  
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Global Secure Access/Analytic Rules/SWG - Abnormal Deny Rate.yaml
name: GSA - Detect Abnormal Deny Rate for Source to Destination IP
version: 1.0.3
severity: Medium
description: |
  Identifies abnormal deny rate for specific source IP to destination IP based on the normal average and standard deviation learned during a configured period. This can indicate potential exfiltration, initial access, or C2, where an attacker tries to exploit the same vulnerability on machines in the organization but is being blocked by firewall rules.

  Configurable Parameters:
      - minimumOfStdsThreshold: The number of stds to use in the threshold calculation. Default is set to 3.
      - learningPeriodTime: Learning period for threshold calculation in days. Default is set to 5.
      - binTime: Learning buckets time in hours. Default is set to 1 hour.
      - minimumThreshold: Minimum threshold for alert. Default is set to 5.
      - minimumBucketThreshold: Minimum learning buckets threshold for alert. Default is set to 5.