Name:Detect New Open S3 Buckets over AWS CLI id:39c61d09-8b30-4154-922b-2d0a694ecc22 version:11 date:None author:Patrick Bareiss, Splunk, vshcherbakov status:production type:TTP Description:The following analytic detects the creation of open/public S3 buckets via the AWS CLI.
It leverages AWS CloudTrail logs to identify events where a user has set bucket permissions to allow access to "AuthenticatedUsers" or "AllUsers." This activity is significant because open S3 buckets can expose sensitive data to unauthorized users, leading to data breaches.
If confirmed malicious, an attacker could gain unauthorized access to potentially sensitive information stored in the S3 bucket, posing a significant security risk. Data_source:
-AWS CloudTrail
search:`cloudtrail` eventSource="s3.amazonaws.com" eventName="PutBucketAcl" errorCode=success userAgent IN ("[aws-cli*", "aws-cli*")
| rename requestParameters.bucketName AS bucketName requestParameters.accessControlList.x-amz-grant-read AS grantRead requestParameters.accessControlList.x-amz-grant-read-acp AS grantReadAcp requestParameters.accessControlList.x-amz-grant-write AS grantWrite requestParameters.accessControlList.x-amz-grant-write-acp AS grantWriteAcp requestParameters.accessControlList.x-amz-grant-full-control AS grantFullControl requestParameters.x-amz-acl AS cannedAcl, userIdentity.principalId AS principalId userIdentity.userName AS userName userIdentity.arn AS userArn
| eval exposure=case(cannedAcl=="public-read-write","public-write", match(grantWrite."".grantWriteAcp."".grantFullControl,"(?i)AllUsers"),"public-write", cannedAcl=="public-read" OR match(grantRead,"(?i)AllUsers"),"public-read", cannedAcl=="authenticated-read" OR match(grantRead,"(?i)AuthenticatedUsers"),"authenticated-read", true(),"custom-grant")
| stats count min(_time) AS firstTime max(_time) AS lastTime values(cannedAcl) AS cannedAcl values(grantRead) AS grantRead values(grantReadAcp) AS grantReadAcp values(grantWrite) AS grantWrite values(grantWriteAcp) AS grantWriteAcp values(grantFullControl) AS grantFullControl values(eventName) AS eventName
how_to_implement:The Splunk AWS Add-on and Splunk App for AWS is required to utilize this data. The search requires AWS Cloudtrail logs. known_false_positives:It is possible that an AWS admin has legitimately created a public bucket for a specific purpose. AWS strongly advises against granting full control to the "All Users" group. Investigate and apply the necessary filters as needed. References: -https://docs.aws.amazon.com/cli/latest/reference/s3api/create-bucket.html drilldown_searches: name:'View the detection results for - "$user$"' search:'%original_detection_search% | search user = "$user$"' earliest_offset:'$info_min_time$' latest_offset:'$info_max_time$' name:'View risk events for the last 7 days for - "$user$"' search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$user$") | 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:'7d' latest_offset:'0' analytic_story:['Suspicious AWS S3 Activities']