Detect Spike in AWS API Activity

Original Source: [splunk source]
Name:Detect Spike in AWS API Activity
id:ada0f478-84a8-4641-a3f1-d32362d4bd55
version:4
date:2024-10-17
author:David Dorsey, Splunk
status:deprecated
type:Anomaly
Description:This search will detect users creating spikes of API activity in your AWS environment. It will also update the cache file that factors in the latest data. This search is deprecated and have been translated to use the latest Change Datamodel.
Data_source:
search:`cloudtrail` eventType=AwsApiCall [search `cloudtrail` eventType=AwsApiCall
| spath output=arn path=userIdentity.arn
| stats count as apiCalls by arn
| inputlookup api_call_by_user_baseline append=t
| fields - latestCount
| stats values(*) as * by arn
| rename apiCalls as latestCount
| eval newAvgApiCalls=avgApiCalls + (latestCount-avgApiCalls)/720
| eval newStdevApiCalls=sqrt(((pow(stdevApiCalls, 2)*719 + (latestCount-newAvgApiCalls)*(latestCount-avgApiCalls))/720))
| eval avgApiCalls=coalesce(newAvgApiCalls, avgApiCalls), stdevApiCalls=coalesce(newStdevApiCalls, stdevApiCalls), numDataPoints=if(isnull(latestCount), numDataPoints, numDataPoints+1)
| table arn, latestCount, numDataPoints, avgApiCalls, stdevApiCalls
| outputlookup api_call_by_user_baseline
| eval dataPointThreshold = 15, deviationThreshold = 3
| eval isSpike=if((latestCount > avgApiCalls+deviationThreshold*stdevApiCalls) AND numDataPoints > dataPointThreshold, 1, 0)
| where isSpike=1
| rename arn as userIdentity.arn
| table userIdentity.arn]
| spath output=user userIdentity.arn
| stats values(eventName) as eventName, count as numberOfApiCalls, dc(eventName) as uniqueApisCalled by user
| `detect_spike_in_aws_api_activity_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 can modify `dataPointThreshold` and `deviationThreshold` to better fit your environment. The `dataPointThreshold` variable is the minimum number of data points required to have a statistically significant amount of data to determine. The `deviationThreshold` variable is the number of standard deviations away from the mean that the value must be to be considered a spike. This search produces fields (`eventName`,`numberOfApiCalls`,`uniqueApisCalled`) 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:** Number of API Calls, **Field:** numberOfApiCalls * **Label:** Unique API Calls, **Field:** uniqueApisCalled 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:None.
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'
    - 'eventType'
    - 'userIdentity.arn'
  risk_score:25.0
  security_domain:network

tests:
  :
manual_test:None

Related Analytic Stories


AWS User Monitoring