Detection rules › Splunk

Detect Spike in AWS Security Hub Alerts for EC2 Instance

Status
production
Severity
low
Group by
_time, dest
Author
Bhavin Patel, Splunk
Source
github.com/splunk/security_content

The following analytic identifies a spike in the number of AWS Security Hub alerts for an EC2 instance within a 4-hour interval. It leverages AWS Security Hub findings data, calculating the average and standard deviation of alerts to detect anomalies. This activity is significant for a SOC as a sudden increase in alerts may indicate potential security incidents or misconfigurations requiring immediate attention. If confirmed malicious, this could signify an ongoing attack, leading to unauthorized access, data exfiltration, or disruption of services on the affected EC2 instance.

Rule body splunk

name: Detect Spike in AWS Security Hub Alerts for EC2 Instance
id: 2a9b80d3-6340-4345-b5ad-290bf5d0d222
version: 12
creation_date: '2020-08-06'
modification_date: '2026-05-13'
author: Bhavin Patel, Splunk
status: production
type: Anomaly
description: The following analytic identifies a spike in the number of AWS Security Hub alerts for an EC2 instance within a 4-hour interval. It leverages AWS Security Hub findings data, calculating the average and standard deviation of alerts to detect anomalies. This activity is significant for a SOC as a sudden increase in alerts may indicate potential security incidents or misconfigurations requiring immediate attention. If confirmed malicious, this could signify an ongoing attack, leading to unauthorized access, data exfiltration, or disruption of services on the affected EC2 instance.
data_source:
    - AWS Security Hub
search: |-
    `aws_securityhub_finding` "Resources{}.Type"=AWSEC2Instance
      | bucket span=4h _time
      | stats count AS alerts values(Title) as Title values(Types{}) as Types values(vendor_account) as vendor_account values(vendor_region) as vendor_region values(severity) as severity
        BY _time dest
      | eventstats avg(alerts) as total_alerts_avg, stdev(alerts) as total_alerts_stdev
      | eval threshold_value = 3
      | eval isOutlier=if(alerts > total_alerts_avg+(total_alerts_stdev * threshold_value), 1, 0)
      | search isOutlier=1
      | table _time dest alerts Title Types vendor_account vendor_region severity isOutlier total_alerts_avg
      | `detect_spike_in_aws_security_hub_alerts_for_ec2_instance_filter`
how_to_implement: You must install the AWS App for Splunk (version 5.1.0 or later) and Splunk Add-on for AWS (version 4.4.0 or later), then configure your Security Hub inputs. The threshold_value should be tuned to your environment and schedule these searches according to the bucket span interval.
known_false_positives: No false positives have been identified at this time.
references: []
drilldown_searches:
    - name: View the detection results for - "$dest$"
      search: '%original_detection_search% | search  dest = "$dest$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$dest$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
      earliest_offset: 7d
      latest_offset: "0"
intermediate_findings:
    entities:
        - field: dest
          type: system
          score: 20
          message: Spike in AWS security Hub alerts with title $Title$ for EC2 instance $dest$
analytic_story:
    - AWS Security Hub Alerts
    - Critical Alerts
asset_type: AWS Instance
mitre_attack_id: []
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: cloud
security_domain: endpoint
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/suspicious_behaviour/security_hub_ec2_spike/security_hub_ec2_spike.json
          sourcetype: aws:securityhub:finding
          source: aws_securityhub_finding
      test_type: unit

Stages and Predicates

Stage 1: search

`aws_securityhub_finding` "Resources{}.Type"=AWSEC2Instance

Stage 2: bucket

| bucket span=4h _time

Stage 3: stats

| stats count AS alerts values(Title) as Title values(Types{}) as Types values(vendor_account) as vendor_account values(vendor_region) as vendor_region values(severity) as severity
    BY _time dest

Stage 4: eventstats

| eventstats avg(alerts) as total_alerts_avg, stdev(alerts) as total_alerts_stdev

Stage 5: eval

| eval threshold_value = 3

Stage 6: eval

| eval isOutlier=if(alerts > total_alerts_avg+(total_alerts_stdev * threshold_value), 1, 0)
isOutlier =
ifalerts > concat(total_alerts_avg, times(total_alerts_stdev, threshold_value))1
else0

Stage 7: search

| search isOutlier=1

Stage 8: table

| table _time dest alerts Title Types vendor_account vendor_region severity isOutlier total_alerts_avg

Stage 9: search

| `detect_spike_in_aws_security_hub_alerts_for_ec2_instance_filter`

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
"Resources{}.Type"eq
  • AWSEC2Instance
isOutliereq
  • 1
sourcetypeeq
  • aws:securityhub:finding