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

Application Gateway WAF - SQLi Detection

Back
Id68c0b6bb-6bd9-4ef4-9011-08998c8ef90f
RulenameApplication Gateway WAF - SQLi Detection
DescriptionIdentifies a match for SQL Injection attack in the Application gateway WAF logs. The Threshold value in the query can be changed as per your infrastructure’s requirement.

References: https://owasp.org/Top10/A03_2021-Injection/
SeverityHigh
TacticsDefenseEvasion
Execution
InitialAccess
PrivilegeEscalation
TechniquesT1211
T1059
T1190
T0890
Required data connectorsWAF
KindScheduled
Query frequency6h
Query period6h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Detections/AzureWAF/AppGwWAF-SQLiDetection.yaml
Version1.0.1
Arm template68c0b6bb-6bd9-4ef4-9011-08998c8ef90f.json
Deploy To Azure
let Threshold = 3;
AzureDiagnostics
| where Category == "ApplicationGatewayFirewallLog"
| where action_s == "Matched"
| project transactionId_g, hostname_s, requestUri_s, TimeGenerated, clientIp_s, Message, details_message_s, details_data_s
| join kind = inner(
AzureDiagnostics
| where Category == "ApplicationGatewayFirewallLog"
| where action_s == "Blocked"
| parse Message with MessageText 'Total Inbound Score: ' TotalInboundScore ' - SQLI=' SQLI_Score ',XSS=' XSS_Score ',RFI=' RFI_Score ',LFI=' LFI_Score ',RCE=' RCE_Score ',PHPI=' PHPI_Score ',HTTP=' HTTP_Score ',SESS=' SESS_Score '): ' Blocked_Reason '; individual paranoia level scores:' Paranoia_Score
| where Blocked_Reason contains "SQL Injection Attack" and toint(SQLI_Score) >=10 and toint(TotalInboundScore) >= 15) on transactionId_g
| extend Uri = strcat(hostname_s,requestUri_s)
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), TransactionID = make_set(transactionId_g), Message = make_set(Message), Detail_Message = make_set(details_message_s), Detail_Data = make_set(details_data_s), Total_TransactionId = dcount(transactionId_g) by clientIp_s, Uri, action_s, SQLI_Score, TotalInboundScore
| where Total_TransactionId >= Threshold
description: |
  'Identifies a match for SQL Injection attack in the Application gateway WAF logs. The Threshold value in the query can be changed as per your infrastructure's requirement.
   References: https://owasp.org/Top10/A03_2021-Injection/'  
kind: Scheduled
tactics:
- DefenseEvasion
- Execution
- InitialAccess
- PrivilegeEscalation
requiredDataConnectors:
- connectorId: WAF
  dataTypes:
  - AzureDiagnostics
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AzureWAF/AppGwWAF-SQLiDetection.yaml
severity: High
name: Application Gateway WAF - SQLi Detection
metadata:
  support:
    tier: Community
  author:
    name: shabaz-github
  categories:
    domains:
    - Security - Threat Protection
    - Platform
  source:
    kind: Community
triggerThreshold: 0
queryPeriod: 6h
query: |
  let Threshold = 3;
  AzureDiagnostics
  | where Category == "ApplicationGatewayFirewallLog"
  | where action_s == "Matched"
  | project transactionId_g, hostname_s, requestUri_s, TimeGenerated, clientIp_s, Message, details_message_s, details_data_s
  | join kind = inner(
  AzureDiagnostics
  | where Category == "ApplicationGatewayFirewallLog"
  | where action_s == "Blocked"
  | parse Message with MessageText 'Total Inbound Score: ' TotalInboundScore ' - SQLI=' SQLI_Score ',XSS=' XSS_Score ',RFI=' RFI_Score ',LFI=' LFI_Score ',RCE=' RCE_Score ',PHPI=' PHPI_Score ',HTTP=' HTTP_Score ',SESS=' SESS_Score '): ' Blocked_Reason '; individual paranoia level scores:' Paranoia_Score
  | where Blocked_Reason contains "SQL Injection Attack" and toint(SQLI_Score) >=10 and toint(TotalInboundScore) >= 15) on transactionId_g
  | extend Uri = strcat(hostname_s,requestUri_s)
  | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), TransactionID = make_set(transactionId_g), Message = make_set(Message), Detail_Message = make_set(details_message_s), Detail_Data = make_set(details_data_s), Total_TransactionId = dcount(transactionId_g) by clientIp_s, Uri, action_s, SQLI_Score, TotalInboundScore
  | where Total_TransactionId >= Threshold  
relevantTechniques:
- T1211
- T1059
- T1190
- T0890
id: 68c0b6bb-6bd9-4ef4-9011-08998c8ef90f
queryFrequency: 6h
entityMappings:
- entityType: URL
  fieldMappings:
  - columnName: Uri
    identifier: Url
- entityType: IP
  fieldMappings:
  - columnName: clientIp_s
    identifier: Address
triggerOperator: gt
version: 1.0.1
tags:
- SQL Injection