Skip to content

Commit 7b88b36

Browse files
updating markdown
1 parent 4330cbb commit 7b88b36

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hunting/aws/docs/iam_unusual_access_key_usage_for_user.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ FROM logs-aws.cloudtrail*
3030
// Ignore GetObject events
3131
and event.action NOT IN ("GetObject")
3232

33-
// Create a daily bucket for the events
34-
| EVAL daily_buckets = DATE_TRUNC(1 days, @timestamp)
33+
// Filter out known service roles; expand this as needed
34+
and NOT aws.cloudtrail.user_identity.arn LIKE "*AWSServiceRoleForConfig*"
35+
and NOT aws.cloudtrail.user_identity.arn LIKE "*Elastic-Cloud-Security-Posture*"
36+
and NOT aws.cloudtrail.user_identity.arn LIKE "*AmazonSSMRoleForInstancesQuickSetup*"
37+
3538
| STATS
3639
// Count the number of events for each daily bucket, user identity, access key, resource, and action
37-
api_counts = count(*) by daily_buckets, aws.cloudtrail.user_identity.arn, aws.cloudtrail.user_identity.access_key_id, aws.cloudtrail.resources.arn, event.action
40+
api_counts = count(*) by aws.cloudtrail.user_identity.arn, aws.cloudtrail.user_identity.access_key_id, event.action
3841

3942
// Filter for access keys with less than 2 API calls per day
4043
| WHERE api_counts < 2

0 commit comments

Comments
 (0)