Detect AWS API Activities From Unapproved Accounts

Original Source: [splunk source]
Name:Detect AWS API Activities From Unapproved Accounts
id:ada0f478-84a8-4641-a3f1-d82362d4bd55
version:4
date:2024-10-17
author:Bhavin Patel, Splunk
status:deprecated
type:Hunting
Description:This search looks for successful AWS CloudTrail activity by user accounts that are not listed in the identity table or `aws_service_accounts.csv`. It returns event names and count, as well as the first and last time a specific user or service is detected, grouped by users. Deprecated because managing this list can be quite hard.
Data_source:
search:`cloudtrail` errorCode=success
| rename userName as identity
| search NOT [| inputlookup identity_lookup_expanded
| fields identity]
| search NOT [| inputlookup aws_service_accounts
| fields identity]
| rename identity as user
| stats count min(_time) as firstTime max(_time) as lastTime values(eventName) as eventName by user
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `detect_aws_api_activities_from_unapproved_accounts_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 AWS CloudTrail inputs. You must also populate the `identity_lookup_expanded` lookup shipped with the Asset and Identity framework to be able to look up users in your identity table in Enterprise Security (ES). Leverage the support search called "Create a list of approved AWS service accounts": run it once every 30 days to create and validate a list of service accounts. This search produces fields (`eventName`,`firstTime`,`lastTime`) that are not yet supported by ES Incident Review and therefore cannot be viewed when a notable event is raised. These fields contribute additional context to the notable. To see the additional metadata, add the following fields, if not already present, to Incident Review - Event Attributes (Configure > Incident Management > Incident Review Settings > Add New Entry): * **Label:** AWS Event Name, **Field:** eventName * **Label:** First Time, **Field:** firstTime * **Label:** Last Time, **Field:** lastTime Detailed documentation on how to create a new field within Incident Review may be found here: `https://docs.splunk.com/Documentation/ES/5.3.0/Admin/Customizenotables#Add_a_field_to_the_notable_event_details`
known_false_positives:It's likely that you'll find activity detected by users/service accounts that are not listed in the `identity_lookup_expanded` or ` aws_service_accounts.csv` file. If the user is a legitimate service account, update the `aws_service_accounts.csv` table with that entry.
References:
drilldown_searches:
  :
tags:
  analytic_story:
    - 'AWS User Monitoring'
  asset_type:AWS Instance
  confidence:50
  impact:50
  message:tbd
  mitre_attack_id:
    - 'T1078.004'
  observable:
    name:'user'
    type:'User'
    - role:
      - 'Victim'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  required_fields:
    - '_time'
    - 'errorCode'
    - 'userName'
    - 'eventName'
    - 'user'
  risk_score:25.0
  security_domain:access

tests:
  :
manual_test:None

Related Analytic Stories


AWS User Monitoring