25 Web Edge Waf Allowed Vs Blocked Attack Trend
Query
// REVIEW ONLY - AWS Security Operations Workbook Visual Query
// Tab: WebEdge | Panel: waf-allowed-vs-blocked-attack-trend | Visualization: barchart | Mode: All
// Security Question: Are web exploit campaigns being blocked cleanly, or are suspicious requests slipping through as ALLOW?
// Drill-Through: Inspect Panel 7.2 below for specific hosts, URIs, and attacker IPs.
// Empty/No-Data Contract: No AWSWAF suspicious/blocked records in window (verify AWSWAF connector status in Tab 2).
let Start = {TimeRange:start};
let End = {TimeRange:end};
let OrgFilter = base64_decode_tostring("{Organization:base64}");
let AccountFilter = base64_decode_tostring("{AwsAccount:base64}");
let RegionFilter = base64_decode_tostring("{AwsRegion:base64}");
let EnvFilter = base64_decode_tostring("{Environment:base64}");
let WorkloadFilter = base64_decode_tostring("{Workload:base64}");
let SeverityFilter = base64_decode_tostring("{Severity:base64}");
let SourceFilter = base64_decode_tostring("{SourceTable:base64}");
let SummaryPref = base64_decode_tostring("{SummaryMode:base64}");
let SelectedPrincipalFilter = base64_decode_tostring("{SelectedPrincipal:base64}");
let SelectedIpFilter = base64_decode_tostring("{SelectedIp:base64}");
union isfuzzy=true
(datatable(TimeGenerated:datetime, Action:string, NonTerminatingMatchingRules:dynamic)[]),
(AWSWAF | where TimeGenerated between (Start .. End)
| project TimeGenerated, Action, NonTerminatingMatchingRules=todynamic(NonTerminatingMatchingRules))
| extend HasNonTermMatch = array_length(NonTerminatingMatchingRules) > 0
| where isnotempty(Action) and (Action != "ALLOW" or HasNonTermMatch)
| extend TrafficOutcome = case(
Action == "ALLOW" and HasNonTermMatch, "ALLOW_WITH_COUNT_MODE_MATCH",
Action == "BLOCK", "BLOCKED",
strcat("CHALLENGE_OR_", Action))
| summarize Requests=count() by bin(TimeGenerated, 15m), TrafficOutcome
| order by TimeGenerated asc
| take 5000Explanation
This query is designed to analyze web traffic data from AWS Web Application Firewall (AWS WAF) to determine if web exploit attempts are being effectively blocked or if any suspicious requests are being allowed. Here's a simplified breakdown of what the query does:
-
Time and Filters Setup: It sets up a time range and various filters (like organization, account, region, environment, etc.) to narrow down the data to be analyzed.
-
Data Union: It combines data from an empty table and AWS WAF logs within the specified time range.
-
Non-Terminating Matches: It checks if there are any non-terminating matching rules for each request, which indicates that the request matched some rules but wasn't blocked.
-
Filtering: It filters out records where the action is empty or where the action is "ALLOW" without any non-terminating matches.
-
Traffic Outcome Classification: It classifies the traffic outcome into:
- "ALLOW_WITH_COUNT_MODE_MATCH" if the request was allowed but matched some rules.
- "BLOCKED" if the request was blocked.
- Other outcomes are labeled with "CHALLENGE_OR_" followed by the action type.
-
Summarization: It summarizes the number of requests by 15-minute intervals and traffic outcome.
-
Ordering and Limiting: It orders the results by time and limits the output to 5000 records.
This query helps visualize trends in how web exploit attempts are handled by AWS WAF, specifically focusing on whether they are blocked or allowed with some rule matches.