AWS Exfiltration via EC2 Snapshot

Original Source: [splunk source]
Name:AWS Exfiltration via EC2 Snapshot
id:ac90b339-13fc-4f29-a18c-4abbba1f2171
version:3
date:2024-09-30
author:Bhavin Patel, Splunk
status:production
type:TTP
Description:The following analytic detects a series of AWS API calls related to EC2 snapshots within a short time window, indicating potential exfiltration via EC2 Snapshot modifications. It leverages AWS CloudTrail logs to identify actions such as creating, describing, and modifying snapshot attributes. This activity is significant as it may indicate an attacker attempting to exfiltrate data by sharing EC2 snapshots externally. If confirmed malicious, the attacker could gain access to sensitive information stored in the snapshots, leading to data breaches and potential compliance violations.
Data_source:
  • -AWS CloudTrail CreateSnapshot
  • -AWS CloudTrail DescribeSnapshotAttribute
  • -AWS CloudTrail ModifySnapshotAttribute
  • -AWS CloudTrail DeleteSnapshot
search:`cloudtrail` eventName IN ("CreateSnapshot", "DescribeSnapshotAttribute", "ModifySnapshotAttribute", "DeleteSnapshot") src_ip !="guardduty.amazonaws.com"
| bin _time span=5m
| stats count dc(eventName) as distinct_api_calls values(eventName) values(requestParameters.attributeType) as attributeType values(requestParameters.createVolumePermission.add.items{}.userId) as aws_account_id_added values(userAgent) as userAgent by _time userName src_ip aws_account_id
| where distinct_api_calls >= 2
| `aws_exfiltration_via_ec2_snapshot_filter`


how_to_implement:You must install splunk AWS add on and Splunk App for AWS. This search works with AWS CloudTrail logs. We have intentionally removed `guardduty.amazonaws.com` from src_ip to remove false positives caused by guard duty. We recommend you adjust the time window as per your environment.
known_false_positives:It is possible that an AWS admin has legitimately shared a snapshot with an other account for a specific purpose. Please check any recent change requests filed in your organization.
References:
  -https://labs.nettitude.com/blog/how-to-exfiltrate-aws-ec2-data/
  -https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifySnapshotAttribute.html
  -https://bleemb.medium.com/data-exfiltration-with-native-aws-s3-features-c94ae4d13436
  -https://stratus-red-team.cloud/attack-techniques/list/
drilldown_searches:
name:'View the detection results for - "$aws_account_id$"'
search:'%original_detection_search% | search aws_account_id = "$aws_account_id$"'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
name:'View risk events for the last 7 days for - "$aws_account_id$"'
search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$aws_account_id$") starthoursago=168 | 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:'$info_min_time$'
latest_offset:'$info_max_time$'
tags:
  analytic_story:
    - 'Suspicious Cloud Instance Activities'
    - 'Data Exfiltration'
  asset_type:EC2 Snapshot
  confidence:80
  impact:80
  message:Potential AWS EC2 Exfiltration detected on account id - $aws_account_id$ by user $userName$ from src_ip $src_ip$
  mitre_attack_id:
    - 'T1537'
  observable:
    name:'userName'
    type:'User'
    - role:
      - 'Attacker'
    name:'src_ip'
    type:'IP Address'
    - role:
      - 'Attacker'
    name:'aws_account_id'
    type:'Other'
    - role:
      - 'Victim'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  required_fields:
    - '_time'
    - 'eventName'
    - 'user_arn'
    - 'src_ip'
    - 'requestParameters.attributeType'
    - 'aws_account_id'
    - 'vendor_region'
    - 'user_agent'
    - 'userIdentity.principalId'
    - 'requestParameters.createVolumePermission.add.items{}.userId'
  risk_score:64
  security_domain:threat

tests:
name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1537/aws_snapshot_exfil/aws_cloudtrail_events.json
  sourcetype: aws:cloudtrail
  source: aws_cloudtrail
  update_timestamp: True
manual_test:None