Query Details

03 Overview Incident And Finding Trend

Query

// REVIEW ONLY - AWS Security Operations Workbook Visual Query
// Tab: Overview | Panel: incident-and-finding-trend | Visualization: barchart | Mode: All
// Security Question: Is active AWS threat activity escalating across incidents and deduplicated High/Critical GuardDuty findings?
// Drill-Through: Navigate to Tab 4 (GuardDuty) or Tab 10 (Coverage & Operations) to triage open incidents.
// Empty/No-Data Contract: No AWS-linked Sentinel incidents or High/Critical GuardDuty findings in the selected window (verify Tab 2 Data Health first).
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}");
let IncTrend = union isfuzzy=true
    (datatable(TimeGenerated:datetime, IncidentName:string, Title:string, Severity:string, CreatedTime:datetime)[]),
    (SecurityIncident | where TimeGenerated between (Start .. End) | project TimeGenerated, IncidentName, Title, Severity, CreatedTime)
| summarize arg_max(TimeGenerated, *) by IncidentName
| where Title has_any ("AWS", "GuardDuty", "CloudTrail", "Route 53", "VPC", "S3", "EKS")
| where SeverityFilter == "*" or Severity =~ SeverityFilter
| summarize Count=count() by TimeBucket=bin(CreatedTime, 1h), Signal=strcat("Incident:", Severity);
let GdTrend = union isfuzzy=true
    (datatable(TimeGenerated:datetime, Id:string, AccountId:string, Region:string, ServiceDetails:dynamic, Severity:real)[]),
    (AWSGuardDuty | where TimeGenerated between (Start .. End) | project TimeGenerated, Id, AccountId, Region, ServiceDetails=todynamic(ServiceDetails), Severity=todouble(Severity))
| where AccountFilter == "*" or AccountId == AccountFilter
| where RegionFilter == "*" or Region == RegionFilter
| summarize arg_max(TimeGenerated, *) by Id
| where tobool(ServiceDetails.archived) != true and Severity >= 7.0
| summarize Count=count() by TimeBucket=bin(TimeGenerated, 1h), Signal="GuardDuty:HighOrCritical";
union IncTrend, GdTrend
| order by TimeBucket asc
| take 5000

Explanation

This query is designed to analyze and visualize trends in AWS security incidents and GuardDuty findings over a specified time range. Here's a simplified explanation:

  1. Purpose: The query aims to determine if there is an escalation in active AWS threat activities by examining incidents and deduplicated high or critical GuardDuty findings.

  2. Filters: It applies various filters based on organization, AWS account, region, environment, workload, severity, source, selected principal, and IP address. These filters are decoded from base64 encoded strings.

  3. Incident Trend Analysis:

    • It gathers data on security incidents from a specified time range.
    • It focuses on incidents related to AWS services like GuardDuty, CloudTrail, Route 53, VPC, S3, and EKS.
    • It summarizes the number of incidents by hour and severity.
  4. GuardDuty Trend Analysis:

    • It collects GuardDuty findings within the same time range.
    • It filters findings based on account, region, and ensures they are not archived and have a severity of 7.0 or higher.
    • It summarizes the number of high or critical findings by hour.
  5. Combining Results: The query combines the incident and GuardDuty trends, orders them by time, and limits the results to 5000 entries.

  6. Visualization: The results are intended to be visualized as a bar chart to show trends over time.

  7. Drill-Through: If further investigation is needed, users can navigate to specific tabs for detailed analysis of open incidents.

  8. No Data Scenario: If no relevant data is found, it suggests verifying data health on another tab.

Overall, this query helps security teams monitor and assess the escalation of AWS-related security threats over time.