Detection: EC2 Instance Started With Previously Unseen AMI

DEPRECATED DETECTION

This detection has been marked as deprecated by the Splunk Threat Research team. This means that it will no longer be maintained or supported. If you have any questions or concerns, please reach out to us at research@splunk.com.

Description

This search looks for EC2 instances being created with previously unseen AMIs. This search is deprecated and have been translated to use the latest Change Datamodel.

 1`cloudtrail` eventName=RunInstances [search `cloudtrail` eventName=RunInstances errorCode=success 
 2| stats earliest(_time) as firstTime latest(_time) as lastTime by requestParameters.instancesSet.items{}.imageId 
 3| rename requestParameters.instancesSet.items{}.imageId as amiID 
 4| inputlookup append=t previously_seen_ec2_amis.csv 
 5| stats min(firstTime) as firstTime max(lastTime) as lastTime by amiID 
 6| outputlookup previously_seen_ec2_amis.csv 
 7| eval newAMI=if(firstTime >= relative_time(now(), "-70m@m"), 1, 0) 
 8| `security_content_ctime(firstTime)`
 9|`security_content_ctime(lastTime)` 
10| where newAMI=1 
11| rename amiID as requestParameters.instancesSet.items{}.imageId 
12| table requestParameters.instancesSet.items{}.imageId] 
13| rename requestParameters.instanceType as instanceType, responseElements.instancesSet.items{}.instanceId as dest, userIdentity.arn as arn, requestParameters.instancesSet.items{}.imageId as amiID 
14| table firstTime, lastTime, arn, amiID, dest, instanceType 
15| `ec2_instance_started_with_previously_unseen_ami_filter`

Data Source

No data sources specified for this detection.

Macros Used

Name Value
cloudtrail sourcetype=aws:cloudtrail
ec2_instance_started_with_previously_unseen_ami_filter search *
ec2_instance_started_with_previously_unseen_ami_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
NistCategory.DE_AE
Cis18Value.CIS_10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Risk Event True
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

Implementation

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 AWS CloudTrail inputs. This search works best when you run the "Previously Seen EC2 AMIs" support search once to create a history of previously seen AMIs.

Known False Positives

After a new AMI is created, the first systems created with that AMI will cause this alert to fire. Verify that the AMI being used was created by a legitimate user.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
tbd 25 50 50
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Not Applicable N/A N/A N/A
Unit ❌ Failing N/A N/A N/A
Integration ❌ Failing N/A N/A N/A

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub | Version: 3