AWS SecOps P2-01a - AWS Network Firewall High-Severity Alert and Allowed Threat Signature (Single-Source)
P2 01a Network Firewall Alert Baseline
Query
// REVIEW ONLY. Validate AWSNetworkFirewallAlert schema via discovery/D08 first.
let SuppressedSignatures = _GetWatchlist('AWS_TrustedDomainsAndScanners')
| where tolower(tostring(column_ifexists("Verified", ""))) == "true" and tostring(column_ifexists("PatternType", "")) == "SuricataSid"
| project tostring(column_ifexists("IndicatorValue", ""));
let FirewallMap = _GetWatchlist('AWS_CriticalAssets')
| where tolower(tostring(column_ifexists("Verified", ""))) == "true" and tostring(column_ifexists("ResourceType", "")) == "NetworkFirewall"
| project FirewallKey=tolower(tostring(column_ifexists("ResourceIdOrName", ""))), AWSAccountId=tostring(column_ifexists("AWSAccountId", "")),
VpcId=tostring(column_ifexists("VpcId", "")), Environment=tostring(column_ifexists("Environment", ""));
AWSNetworkFirewallAlert
| where TimeGenerated > ago(1h) and ingestion_time() > ago(15m)
| where SignatureId !in (SuppressedSignatures)
| where Severity in ("1", "2", "High", "Critical") or AlertAction =~ "allowed" or VerdictAction =~ "pass"
| extend FirewallKey = tolower(FirewallName)
| join kind=leftouter FirewallMap on FirewallKey
| summarize TimeGenerated=min(TimeGenerated), HitCount=count(), SampleSni=take_any(Sni),
Categories=make_set(Category, 5), Verdicts=make_set(VerdictAction, 5)
by FirewallName, AvailabilityZone, SrcIp, DestIp, DestPort, Proto, SignatureId, Signature,
Severity, AWSAccountId=coalesce(AWSAccountId, "MapFirewallInWatchlist"),
VpcId=coalesce(VpcId, "MapFirewallInWatchlist")
| extend HitCountStr = tostring(HitCount),
VerdictSummary = tostring(Verdicts)
| project TimeGenerated, AWSAccountId, VpcId, FirewallName, AvailabilityZone,
SourceIpAddress=SrcIp, DestinationIpAddress=DestIp, DestPort, Proto,
SignatureId, Signature, Severity, SampleSni, HitCountStr, VerdictSummaryExplanation
This query is designed to monitor and alert on high-severity network security events detected by AWS Network Firewall. Here's a simplified breakdown of what it does:
-
Purpose: The query identifies high-severity alerts or threat signatures from AWS Network Firewall where potentially harmful traffic was allowed through the firewall. It focuses on alerts with severity levels 1 or 2 and suppresses known noisy alerts using a predefined list of trusted domains and scanners.
-
Data Sources: It uses data from AWS Network Firewall alerts and cross-references it with two watchlists:
AWS_TrustedDomainsAndScanners: Contains signature IDs that should be ignored.AWS_CriticalAssets: Maps firewall names to AWS account IDs and VPC IDs, as these details are not included in the alerts by default.
-
Query Logic:
- Filters alerts from the past hour that were ingested in the last 15 minutes.
- Excludes alerts with suppressed signature IDs.
- Focuses on alerts with high severity or where traffic was allowed through the firewall.
- Joins the alert data with the critical assets watchlist to enrich it with account and VPC information.
- Summarizes the data by various fields such as source and destination IPs, ports, and protocols, and counts the number of hits for each alert.
-
Output: The query produces a summarized list of alerts with details like the firewall name, source and destination IPs, severity, and a count of how many times each alert was triggered.
-
Incident Management: If any alerts are found, it creates an incident in the security system. The incidents are grouped by firewall name and signature ID to manage them efficiently.
-
Configuration: The query is scheduled to run every 15 minutes and is set to trigger an alert if any matching events are found.
Overall, this query helps security teams quickly identify and respond to potential threats that have been allowed through AWS Network Firewall, prioritizing high-severity events and reducing noise from known benign sources.