Detection: Detect New Open S3 buckets

Description

The following analytic identifies the creation of open/public S3 buckets in AWS. It detects this activity by analyzing AWS CloudTrail events for PutBucketAcl actions where the access control list (ACL) grants permissions to all users or authenticated users. This activity is significant because open S3 buckets can expose sensitive data to unauthorized access, leading to data breaches. If confirmed malicious, an attacker could read, write, or fully control the contents of the bucket, potentially leading to data exfiltration or tampering.

 1`cloudtrail` eventSource=s3.amazonaws.com eventName=PutBucketAcl
 2  
 3| rex field=_raw "(?<json_field>{.+})"
 4  
 5| spath input=json_field output=grantees path=requestParameters.AccessControlPolicy.AccessControlList.Grant{}
 6  
 7| search grantees=*
 8  
 9| mvexpand grantees
10  
11| spath input=grantees output=uri path=Grantee.URI
12  
13| spath input=grantees output=permission path=Permission
14  
15| search uri IN ("http://acs.amazonaws.com/groups/global/AllUsers","http://acs.amazonaws.com/groups/global/AuthenticatedUsers")
16  
17| search permission IN ("READ","READ_ACP","WRITE","WRITE_ACP","FULL_CONTROL")
18  
19| rename requestParameters.bucketName AS bucketName
20  
21| stats count min(_time) as firstTime max(_time) as lastTime
22    BY user_arn userIdentity.principalId userAgent
23       uri permission bucketName
24  
25| `security_content_ctime(firstTime)`
26  
27| `security_content_ctime(lastTime)`
28  
29| `detect_new_open_s3_buckets_filter`

Data Source

Name Platform Sourcetype Source
AWS CloudTrail AWS icon AWS 'aws:cloudtrail' 'aws_cloudtrail'

Macros Used

Name Value
cloudtrail sourcetype=aws:cloudtrail
detect_new_open_s3_buckets_filter search *
detect_new_open_s3_buckets_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
T1530 Data from Cloud Storage Collection
Exploitation
DE.CM
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 Notable Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Risk Event True
This configuration file applies to all detections of type TTP. These detections will use Risk Based Alerting and generate Notable Events.

Implementation

You must install the AWS App for Splunk.

Known False Positives

While this search has no known false positives, it is possible that an AWS admin has legitimately created a public bucket for a specific purpose. That said, AWS strongly advises against granting full control to the "All Users" group.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

User $user_arn$ has created an open/public bucket $bucketName$ with the following permissions $permission$

Risk Object Risk Object Type Risk Score Threat Objects
user_arn user 48 No Threat Objects

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset aws_cloudtrail aws:cloudtrail
Integration ✅ Passing Dataset aws_cloudtrail aws:cloudtrail

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: 8