App Gateway WAF - XSS Detection
| Id | 1c7ff502-2ad4-4970-9d29-9210c6753138 |
| Rulename | App Gateway WAF - XSS Detection |
| Description | Identifies a match for an XSS 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/xss/ |
| Severity | High |
| Tactics | InitialAccess Execution |
| Techniques | T1189 T1203 T0853 |
| Required data connectors | WAF |
| Kind | Scheduled |
| Query frequency | 6h |
| Query period | 6h |
| Trigger threshold | 0 |
| Trigger operator | gt |
| Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Azure Web Application Firewall (WAF)/Analytic Rules/App-GW-WAF-XSSDetection.yaml |
| Version | 1.0.2 |
| Arm template | 1c7ff502-2ad4-4970-9d29-9210c6753138.json |
let Threshold = 3;
AGWFirewallLogs
| where Action == "Matched"
| where Message has "XSS"
| project TransactionId, Hostname, RequestUri, TimeGenerated, ClientIp, Message
| join kind = inner(
AGWFirewallLogs
| where Action == "Blocked"
| extend transactionId_g = tostring(TransactionId)) on TransactionId
| extend Uri = strcat(Hostname,RequestUri)
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), TransactionID = make_set(transactionId_g,100), Message = make_set(Message,100), Total_TransactionId = dcount(transactionId_g) by ClientIp, Uri, Action
| where Total_TransactionId >= Threshold
kind: Scheduled
entityMappings:
- entityType: URL
fieldMappings:
- columnName: Uri
identifier: Url
- entityType: IP
fieldMappings:
- columnName: ClientIp
identifier: Address
description: |
'Identifies a match for an XSS 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/xss/'
severity: High
queryFrequency: 6h
triggerThreshold: 0
relevantTechniques:
- T1189
- T1203
- T0853
tags:
- Cross Site Scripting
status: Available
tactics:
- InitialAccess
- Execution
name: App Gateway WAF - XSS Detection
id: 1c7ff502-2ad4-4970-9d29-9210c6753138
query: |
let Threshold = 3;
AGWFirewallLogs
| where Action == "Matched"
| where Message has "XSS"
| project TransactionId, Hostname, RequestUri, TimeGenerated, ClientIp, Message
| join kind = inner(
AGWFirewallLogs
| where Action == "Blocked"
| extend transactionId_g = tostring(TransactionId)) on TransactionId
| extend Uri = strcat(Hostname,RequestUri)
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), TransactionID = make_set(transactionId_g,100), Message = make_set(Message,100), Total_TransactionId = dcount(transactionId_g) by ClientIp, Uri, Action
| where Total_TransactionId >= Threshold
requiredDataConnectors:
- dataTypes:
- AzureDiagnostics
connectorId: WAF
version: 1.0.2
triggerOperator: gt
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Azure Web Application Firewall (WAF)/Analytic Rules/App-GW-WAF-XSSDetection.yaml
queryPeriod: 6h
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspace": {
"type": "String"
}
},
"resources": [
{
"apiVersion": "2024-01-01-preview",
"id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/1c7ff502-2ad4-4970-9d29-9210c6753138')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/1c7ff502-2ad4-4970-9d29-9210c6753138')]",
"properties": {
"alertRuleTemplateName": "1c7ff502-2ad4-4970-9d29-9210c6753138",
"customDetails": null,
"description": "'Identifies a match for an XSS attack in the App Gateway WAF logs. The threshold value in the query can be changed as per your infrastructure's requirements.\n References: https://owasp.org/www-community/attacks/xss/'\n",
"displayName": "App Gateway WAF - XSS Detection",
"enabled": true,
"entityMappings": [
{
"entityType": "URL",
"fieldMappings": [
{
"columnName": "Uri",
"identifier": "Url"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"columnName": "ClientIp",
"identifier": "Address"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Azure Web Application Firewall (WAF)/Analytic Rules/App-GW-WAF-XSSDetection.yaml",
"query": "let Threshold = 3; \nAGWFirewallLogs\n| where Action == \"Matched\"\n| where Message has \"XSS\"\n| project TransactionId, Hostname, RequestUri, TimeGenerated, ClientIp, Message\n| join kind = inner(\nAGWFirewallLogs\n| where Action == \"Blocked\"\n| extend transactionId_g = tostring(TransactionId)) on TransactionId\n| extend Uri = strcat(Hostname,RequestUri)\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), TransactionID = make_set(transactionId_g,100), Message = make_set(Message,100), Total_TransactionId = dcount(transactionId_g) by ClientIp, Uri, Action\n| where Total_TransactionId >= Threshold\n",
"queryFrequency": "PT6H",
"queryPeriod": "PT6H",
"severity": "High",
"status": "Available",
"subTechniques": [],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"Execution",
"InitialAccess"
],
"tags": [
"Cross Site Scripting"
],
"techniques": [
"T1189",
"T1203"
],
"templateVersion": "1.0.2",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}