Skip to content

Commit ec007d4

Browse files
authored
Merge branch 'develop' into cisco_ai_defense
2 parents ebdd770 + 0eb6830 commit ec007d4

5 files changed

+240
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Baseline Of Open S3 Bucket Decommissioning
2+
id: 984e9022-b87b-499a-a260-8d0282c46ea2
3+
version: 1
4+
date: '2025-02-12'
5+
author: Jose Hernandez
6+
type: Baseline
7+
status: production
8+
description: |-
9+
The following analytic identifies S3 buckets that were previously exposed to the public and have been subsequently deleted. It leverages AWS CloudTrail logs to track the lifecycle of potentially risky S3 bucket configurations. This activity is crucial for ensuring that public access to sensitive data is properly managed and decommissioned. By monitoring these events, organizations can ensure that exposed buckets are promptly deleted, reducing the risk of unauthorized access. Immediate investigation is recommended to confirm the proper decommissioning of these buckets and to ensure no sensitive data remains exposed. This baseline detection creates a lookup table of decommissioned buckets.csv and their associated events which can be used by detection searches to trigger alerts when decommissioned buckets are detected.
10+
11+
The following detections searches leverage this baseline search and the lookup table.
12+
* Detect DNS Query to Decommissioned S3 Bucket
13+
* Detect Web Access to Decommissioned S3 Bucket
14+
search: '`cloudtrail` eventSource="s3.amazonaws.com" (eventName=DeleteBucket OR eventName=PutBucketPolicy OR eventName=PutBucketWebsite)
15+
| spath input=_raw path=requestParameters.bucketName output=bucketName
16+
| spath input=_raw path=requestParameters.Host output=host
17+
| spath input=_raw path=requestParameters.bucketPolicy.Statement{} output=statements
18+
| spath input=statements output=principal path=Principal
19+
| spath input=statements output=effect path=Effect
20+
| spath input=statements output=action path=Action
21+
| stats values(eventName) as events,
22+
values(requestParameters.bucketPolicy) as policies,
23+
values(principal) as principals,
24+
values(effect) as effects,
25+
values(action) as actions,
26+
min(_time) as firstEvent,
27+
max(_time) as lastEvent,
28+
values(userIdentity.accountId) as accountIds,
29+
values(userIdentity.arn) as userARNs,
30+
values(awsRegion) as awsRegions,
31+
values(host) as hosts
32+
by bucketName
33+
| eval isPublicPolicy = if( (mvfind(principals, "\\*")>=0) AND (mvfind(effects, "Allow")>=0) AND (mvfind(actions, "s3:GetObject")>=0), 1, 0)
34+
| eval isWebsite = if(mvfind(events, "PutBucketWebsite")>=0, 1, 0)
35+
| eval is_open = if(isPublicPolicy==1 OR isWebsite==1, 1, 0)
36+
| where is_open==1 AND (mvfind(events, "DeleteBucket")>=0)
37+
| eval policy_details = if(isPublicPolicy==1, "Policy: Principal=" . mvjoin(principals, ", ") . " Effect=" . mvjoin(effects, ", ") . " Action=" . mvjoin(actions, ", "), "No Public Policy")
38+
| eval website_details = if(isWebsite==1, "Static Website Enabled", "No Website Hosting")
39+
| table bucketName, hosts, firstEvent, lastEvent, events, policy_details, website_details, accountIds, userARNs, awsRegions
40+
| outputlookup append=true decommissioned_buckets | `baseline_of_open_s3_bucket_decommissioning_filter`'
41+
how_to_implement: To implement this baseline, you need to have AWS CloudTrail logs being ingested into Splunk with the AWS Add-on properly configured. The search looks for S3 bucket events related to bucket policies, website hosting configuration, and bucket deletion. The results are stored in a lookup KVStore named decommissioned_buckets which tracks the history of deleted buckets that were previously exposed to the public.
42+
known_false_positives: Some buckets may be intentionally made public for legitimate business purposes before being decommissioned. Review the policy_details and website_details fields to understand the nature of the public access that was configured.
43+
references:
44+
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html
45+
- https://labs.watchtowr.com/8-million-requests-later-we-made-the-solarwinds-supply-chain-attack-look-amateur/
46+
- https://aws.amazon.com/premiumsupport/knowledge-center/secure-s3-resources/
47+
tags:
48+
analytic_story:
49+
- AWS S3 Bucket Security Monitoring
50+
- Suspicious AWS S3 Activities
51+
product:
52+
- Splunk Enterprise
53+
- Splunk Enterprise Security
54+
- Splunk Cloud
55+
detections:
56+
- Detect DNS Query to Decommissioned S3 Bucket
57+
- Detect Web Access to Decommissioned S3 Bucket
58+
security_domain: audit
59+
deployment:
60+
scheduling:
61+
cron_schedule: 0 2 * * 0
62+
earliest_time: -30d@d
63+
latest_time: -1d@d
64+
schedule_window: auto
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Detect DNS Query to Decommissioned S3 Bucket
2+
id: 2f1c5fd1-4b8a-4f5d-a0e9-7d6a8e2f5e1e
3+
version: 1
4+
date: '2025-02-12'
5+
author: Jose Hernandez, Splunk
6+
status: experimental
7+
type: Anomaly
8+
description: This detection identifies DNS queries to domains that match previously decommissioned S3 buckets. This activity is significant because attackers may attempt to recreate deleted S3 buckets that were previously public to hijack them for malicious purposes. If successful, this could allow attackers to host malicious content or exfiltrate data through compromised bucket names that may still be referenced by legitimate applications.
9+
data_source:
10+
- Sysmon EventID 22
11+
search: '| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Network_Resolution where DNS.message_type=QUERY by DNS.query DNS.src
12+
| `drop_dm_object_name("DNS")`
13+
| `security_content_ctime(firstTime)`
14+
| `security_content_ctime(lastTime)`
15+
| eval bucket_domain = lower(query)
16+
| lookup decommissioned_buckets bucketName as bucket_domain OUTPUT bucketName as match
17+
| where isnotnull(match)
18+
| `detect_dns_query_to_decommissioned_s3_bucket_filter`'
19+
how_to_implement: To successfully implement this detection, you need to be ingesting DNS query logs and have them mapped to the Network_Resolution data model. Additionally, ensure that the baseline search "Baseline Of Open S3 Bucket Decommissioning" is running and populating the decommissioned_buckets KVstore lookup.
20+
known_false_positives: Some applications or scripts may continue to reference old S3 bucket names after they have been decommissioned. These should be investigated and updated to prevent potential security risks.
21+
references:
22+
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html
23+
- https://labs.watchtowr.com/8-million-requests-later-we-made-the-solarwinds-supply-chain-attack-look-amateur/
24+
drilldown_searches:
25+
- name: DNS Activity for Host
26+
search: '| from datamodel:Network_Resolution | search src="$src$"'
27+
earliest_offset: -7d@d
28+
latest_offset: now
29+
rba:
30+
message: A DNS query to decommissioned S3 bucket $query$ was detected from host $src$
31+
risk_objects:
32+
- field: src
33+
type: system
34+
score: 30
35+
threat_objects:
36+
- field: query
37+
type: domain
38+
tags:
39+
analytic_story:
40+
- AWS S3 Bucket Security Monitoring
41+
- Data Destruction
42+
asset_type: Network
43+
mitre_attack_id:
44+
- T1485
45+
product:
46+
- Splunk Enterprise
47+
- Splunk Enterprise Security
48+
- Splunk Cloud
49+
security_domain: network
50+
tests:
51+
- name: Baseline Dataset Test
52+
attack_data:
53+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1485/decommissioned_buckets/cloudtrail.json
54+
source: cloudtrail
55+
sourcetype: aws:cloudtrail
56+
- name: True Positive Test
57+
attack_data:
58+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1485/decommissioned_buckets/dns.log
59+
source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
60+
sourcetype: XmlWinEventLog
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Detect Web Access to Decommissioned S3 Bucket
2+
id: 3a1d8f62-5b9c-4e7d-b8f3-9d6a8e2f5e1f
3+
version: 1
4+
date: '2025-02-12'
5+
author: Jose Hernandez, Splunk
6+
status: experimental
7+
type: Anomaly
8+
description: This detection identifies web requests to domains that match previously decommissioned S3 buckets through web proxy logs. This activity is significant because attackers may attempt to access or recreate deleted S3 buckets that were previously public to hijack them for malicious purposes. If successful, this could allow attackers to host malicious content or exfiltrate data through compromised bucket names that may still be referenced by legitimate applications.
9+
data_source:
10+
- AWS Cloudfront
11+
search: '| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime values(Web.http_method) as http_method values(Web.http_user_agent) as http_user_agent values(Web.url) as url values(Web.user) as user from datamodel=Web where Web.url_domain!="" by Web.src Web.url_domain
12+
| `drop_dm_object_name("Web")`
13+
| `security_content_ctime(firstTime)`
14+
| `security_content_ctime(lastTime)`
15+
| eval bucket_domain = lower(url_domain)
16+
| lookup decommissioned_buckets bucketName as bucket_domain OUTPUT bucketName as match
17+
| where isnotnull(match)
18+
| `detect_web_access_to_decommissioned_s3_bucket_filter`'
19+
how_to_implement: To successfully implement this detection, you need to be ingesting web proxy logs and have them mapped to the Web data model. Additionally, ensure that the baseline search "Baseline Of Open S3 Bucket Decommissioning" is running and populating the decommissioned_buckets KVStore Lookup.
20+
known_false_positives: Some applications or web pages may continue to reference old S3 bucket URLs after they have been decommissioned. These should be investigated and updated to prevent potential security risks.
21+
references:
22+
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html
23+
- https://labs.watchtowr.com/8-million-requests-later-we-made-the-solarwinds-supply-chain-attack-look-amateur/
24+
drilldown_searches:
25+
- name: Web Activity for Host and User
26+
search: '| from datamodel:Web | search src="$src$" user="$user$"'
27+
earliest_offset: -7d@d
28+
latest_offset: now
29+
- name: Investigate traffic to domain
30+
search: '| from datamodel:Web | search src="$src$" url_domain="$url_domain$"'
31+
earliest_offset: -7d@d
32+
latest_offset: now
33+
rba:
34+
message: A web request to decommissioned S3 bucket domain $url_domain$ was detected from host $src$ by user $user$
35+
risk_objects:
36+
- field: src
37+
type: system
38+
score: 30
39+
threat_objects:
40+
- field: url_domain
41+
type: domain
42+
tags:
43+
analytic_story:
44+
- AWS S3 Bucket Security Monitoring
45+
- Data Destruction
46+
asset_type: S3 Bucket
47+
mitre_attack_id:
48+
- T1485
49+
product:
50+
- Splunk Enterprise
51+
- Splunk Enterprise Security
52+
- Splunk Cloud
53+
security_domain: network
54+
tests:
55+
- name: Baseline Dataset Test
56+
attack_data:
57+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1485/decommissioned_buckets/cloudtrail.json
58+
source: cloudtrail
59+
sourcetype: aws:cloudtrail
60+
- name: True Positive Test
61+
attack_data:
62+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1485/decommissioned_buckets/web_cloudfront_access.log
63+
source: aws_cloudfront_accesslogs
64+
sourcetype: aws:cloudfront:accesslogs

lookups/decommissioned_buckets.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: decommissioned_buckets
2+
date: 2025-02-14
3+
version: 1
4+
id: b3a95eff-87cf-40f3-b6e0-5b1a11eed68f
5+
author: Bhavin Patel
6+
lookup_type: kvstore
7+
default_match: false
8+
description: A lookup table of decommissioned S3 buckets created by baseline - Baseline of Open S3 Bucket Decommissioning. This lookup table is used by detections searches to trigger alerts when decommissioned buckets are detected.
9+
min_matches: 1
10+
fields:
11+
- _key
12+
- bucketName
13+
- hosts
14+
- firstEvent
15+
- lastEvent
16+
- events
17+
- policy_details
18+
- website_details
19+
- accountIds
20+
- userARNs
21+
- awsRegions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: AWS S3 Bucket Security Monitoring
2+
id: 8d74f258-d69e-4e4f-b7b3-57c0bdc772b5
3+
version: 1
4+
date: '2025-02-12'
5+
author: Jose Hernandez, Splunk
6+
status: production
7+
description: This analytic story contains detections that monitor AWS S3 bucket configurations, access patterns, and potential security risks, with a specific focus on tracking decommissioned public buckets to prevent bucket hijacking attempts.
8+
narrative: 'Amazon Simple Storage Service (S3) is a widely used object storage service that allows organizations to store and retrieve any amount of data. While S3 buckets are private by default, they can be configured for public access through bucket policies or static website hosting. This flexibility, while useful for legitimate purposes, can also lead to security risks if not properly managed.
9+
10+
A particularly concerning attack vector is the hijacking of decommissioned S3 buckets. When a public S3 bucket is deleted, its unique name becomes available for anyone to claim. Attackers can monitor for deleted buckets that were previously public and attempt to recreate them, potentially intercepting data from applications that still reference these buckets or using them to host malicious content.
11+
12+
This analytic story focuses on:
13+
1. Tracking S3 buckets that were public (via policy or website hosting) before deletion
14+
2. Detecting attempts to access or query these decommissioned bucket names
15+
3. Identifying potential bucket hijacking attempts
16+
4. Helping organizations maintain proper S3 bucket hygiene and prevent security incidents related to bucket name reuse
17+
18+
The detections in this story leverage AWS CloudTrail logs, DNS queries, and web proxy data to provide comprehensive monitoring of S3 bucket lifecycle and access patterns.'
19+
references:
20+
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html
21+
- https://labs.watchtowr.com/8-million-requests-later-we-made-the-solarwinds-supply-chain-attack-look-amateur/
22+
- https://aws.amazon.com/premiumsupport/knowledge-center/secure-s3-resources/
23+
tags:
24+
category:
25+
- Cloud Security
26+
product:
27+
- Splunk Security Analytics for AWS
28+
- Splunk Enterprise
29+
- Splunk Enterprise Security
30+
- Splunk Cloud
31+
usecase: Security Monitoring

0 commit comments

Comments
 (0)