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

App GW WAF - Code Injection

Back
Id912a18fc-6165-446b-8740-81ae6c3f75ee
RulenameApp GW WAF - Code Injection
DescriptionIdentifies a match for a Code Injection based attack in the App Gateway WAF logs. The threshold value in the query can be changed as per your infrastructure’s requirements.

References: https://owasp.org/www-community/attacks/Code_Injection
SeverityHigh
TacticsDefenseEvasion
Execution
InitialAccess
PrivilegeEscalation
TechniquesT1548
T1203
T1190
T1548
Required data connectorsWAF
KindScheduled
Query frequency6h
Query period6h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Azure Web Application Firewall (WAF)/Analytic Rules/App-GW-WAF-Code-Injection.yaml
Version1.0.3
Arm template912a18fc-6165-446b-8740-81ae6c3f75ee.json
Deploy To Azure
let Threshold = 3;  
AGWFirewallLogs
| where Action == "Matched"
| where Message has "Injection" or Message has "File Inclusion"
| project TransactionId, Hostname, RequestUri, TimeGenerated, ClientIp, Message, DetailedMessage, DetailedData
| join kind = inner(
AGWFirewallLogs
| where Action == "Blocked") on TransactionId
| extend Uri = strcat(Hostname,RequestUri)
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), TransactionID = make_set(TransactionId,100), Message = make_set(Message,100), Detail_Message = make_set(DetailedMessage,100), Detail_Data = make_set(DetailedData,100), Total_TransactionId = dcount(TransactionId) by ClientIp, Uri, Action
| where Total_TransactionId >= Threshold
description: |
  'Identifies a match for a Code Injection based attack in the App Gateway WAF logs. The threshold value in the query can be changed as per your infrastructure's requirements.
  References: https://owasp.org/www-community/attacks/Code_Injection'  
version: 1.0.3
triggerThreshold: 0
tactics:
- DefenseEvasion
- Execution
- InitialAccess
- PrivilegeEscalation
queryPeriod: 6h
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Azure Web Application Firewall (WAF)/Analytic Rules/App-GW-WAF-Code-Injection.yaml
triggerOperator: gt
status: Available
id: 912a18fc-6165-446b-8740-81ae6c3f75ee
name: App GW WAF - Code Injection
queryFrequency: 6h
severity: High
kind: Scheduled
entityMappings:
- fieldMappings:
  - columnName: Uri
    identifier: Url
  entityType: URL
- fieldMappings:
  - columnName: ClientIp
    identifier: Address
  entityType: IP
relevantTechniques:
- T1548
- T1203
- T1190
- T1548
query: |
  let Threshold = 3;  
  AGWFirewallLogs
  | where Action == "Matched"
  | where Message has "Injection" or Message has "File Inclusion"
  | project TransactionId, Hostname, RequestUri, TimeGenerated, ClientIp, Message, DetailedMessage, DetailedData
  | join kind = inner(
  AGWFirewallLogs
  | where Action == "Blocked") on TransactionId
  | extend Uri = strcat(Hostname,RequestUri)
  | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), TransactionID = make_set(TransactionId,100), Message = make_set(Message,100), Detail_Message = make_set(DetailedMessage,100), Detail_Data = make_set(DetailedData,100), Total_TransactionId = dcount(TransactionId) by ClientIp, Uri, Action
  | where Total_TransactionId >= Threshold  
tags:
- Code Injection
requiredDataConnectors:
- dataTypes:
  - AzureDiagnostics
  connectorId: WAF