Skip to content

Commit 88d9811

Browse files
authored
[Rule Tunings] AWS SNS new Terms rules (#5082)
AWS SNS is a pub/sub style service where users can subscribe to a topic and receive messages published to that topic. Below is a screenshot of the different protocols a user could subscribe with and the various endpoints that could be associated with those protocols. AWS SNS Email Subscription by Rare User --> AWS SNS Rare Protocol Subscription by User (not a new rule) - changed the scope of the rule to capture the first time a user/role subscribes to a topic via a particular protocol (ie. email, http, lambda, mobile). Subscribing to an SNS topic via email is a rather normal behavior and it would be normal for each user to subscribe this way "for the first time" making this rule not as valuable as it was intended to be. - reduced execution window - added real-world threat references - added additional MITRE technique and Impact tag - small edits to IG and Description - edited highlighted fields AWS SNS Topic Message Publish by Rare User - added AWS to name for consistency -changed new terms fields to use a combination of cloud.account.id and user.name against the topic itself `aws.cloudtrail.resources.arn`. So that instead of simply evaluating the first time a user/role publishes a message to ANY topic, this rule now looks for the first time a user/role publishes a message to a particular topic. We want to make this distinction to capture the case where an identity responsible for publishing to a particular topic A suddenly starts publishing to another topic B, which indicates behavior that should be verified. - reduced new terms window - added setup notes as Data events are necessary for capturing the `Publish` API call - reduced execution window - added real-world threat references - added additional MITRE technique and Impact tag - small edits to IG and Description - edited highlighted fields AWS SNS Topic Created by Rare User - removed the `AssumedRole` and `*-i*` parameters from the query as this narrowed the query to only alert on behavior from EC2 instance roles. We ideally want to evaluate this behavior for all users and roles. - reduced execution window - added real-world threat references - added additional MITRE technique and Impact tag - small edits to IG and Description - edited highlighted fields
1 parent fcc82fa commit 88d9811

File tree

4 files changed

+132
-73
lines changed

4 files changed

+132
-73
lines changed

detection_rules/etc/non-ecs-schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@
179179
"aws.cloudtrail.flattened.request_parameters.reason": "keyword",
180180
"aws.cloudtrail.flattened.request_parameters.omitted": "keyword",
181181
"aws.cloudtrail.flattened.response_elements.documentDescription.documentType": "keyword",
182-
"aws.cloudtrail.flattened.request_parameters.groupSet.items.groupId": "keyword"
182+
"aws.cloudtrail.flattened.request_parameters.groupSet.items.groupId": "keyword",
183+
"aws.cloudtrail.flattened.request_parameters.protocol": "keyword"
183184
},
184185
"logs-azure.signinlogs-*": {
185186
"azure.signinlogs.properties.conditional_access_audiences.application_id": "keyword",

rules/integrations/aws/exfiltration_sns_email_subscription_by_rare_user.toml renamed to rules/integrations/aws/exfiltration_sns_rare_protocol_subscription_by_user.toml

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,40 @@
22
creation_date = "2024/11/01"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/02/12"
5+
updated_date = "2025/09/09"
66

77
[rule]
88
author = ["Elastic"]
99
description = """
10-
Identifies when an SNS topic is subscribed to by an email address of a user who does not typically perform this action.
11-
Adversaries may subscribe to an SNS topic to collect sensitive information or exfiltrate data via an external email
12-
address.
10+
Identifies when a use subscribes to an SNS topic using a new protocol type (ie. email, http, lambda, etc.). SNS allows users to subscribe to recieve topic messages across a broad range of protocols like email, sms, lambda functions, http endpoints, and applications. Adversaries may subscribe to an SNS topic to collect sensitive information or exfiltrate data via an external email address, cross-account AWS service or other means. This rule identifies a new protocol subscription method for a particular user.
1311
"""
1412
false_positives = [
1513
"""
16-
Legitimate users may subscribe to SNS topics for legitimate purposes. Ensure that the subscription is authorized and
17-
the subscription email address is known before taking action.
14+
Legitimate users may subscribe to SNS topics for legitimate purposes. Ensure that the subscription is authorized before taking action.
1815
""",
1916
]
20-
from = "now-9m"
17+
from = "now-6m"
2118
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
2219
language = "kuery"
2320
license = "Elastic License v2"
24-
name = "AWS SNS Email Subscription by Rare User"
21+
name = "AWS SNS Rare Protocol Subscription by User"
2522
note = """## Triage and analysis
2623
27-
### Investigating AWS SNS Email Subscription by Rare User
24+
### Investigating AWS SNS Rare Protocol Subscription by User
2825
29-
This rule identifies when an SNS topic is subscribed to by an email address of a user who does not typically perform this action. While subscribing to SNS topics is a common practice, adversaries may exploit this feature to collect sensitive information or exfiltrate data via an external email address.
26+
This rule identifies when an SNS topic is subscribed to by a rare protocol for a particular user. While subscribing to SNS topics is a common practice, adversaries may exploit this feature to collect sensitive information or exfiltrate data via an external email address, mobile number, or cross-account AWS service like Lambda.
3027
31-
This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that only flags when this behavior is observed for the first time on a host in the last 14 days.
28+
This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that only flags when this behavior is observed using a protocol for the first time.
3229
3330
#### Possible Investigation Steps
3431
3532
- **Identify the Actor**: Review the `aws.cloudtrail.user_identity.arn` field to identify the user who requested the subscription. Verify if this actor typically performs such actions and has the necessary permissions. It may be unusual for this activity to originate from certain user types, such as an assumed role or federated user.
3633
- **Review the SNS Subscription Event**: Analyze the specifics of the `Subscribe` action in CloudTrail logs:
37-
- **Topic**: Look at the `aws.cloudtrail.request_parameters.topicArn` field to identify the SNS topic involved in the subscription.
38-
- **Protocol and Endpoint**: Review the `aws.cloudtrail.request_parameters.protocol` and `aws.cloudtrail.request_parameters.endpoint` fields to confirm the subscription's protocol and email address. Confirm if this endpoint is associated with a known or trusted entity.
39-
- **Subscription Status**: Check the `aws.cloudtrail.response_elements.subscriptionArn` field for the subscription's current status, noting if it requires confirmation.
34+
- **Topic**: Look at the `aws.cloudtrail.request_parameters` or `target.entity.id` field to identify the SNS topic involved in the subscription.
35+
- **Protocol and Endpoint**: Review the `aws.cloudtrail.request_parameters` field to confirm the subscription's protocol and endpoint, if available. Confirm if this endpoint is associated with a known or trusted entity.
36+
- **Subscription Status**: Check the `aws.cloudtrail.response_elements` field for the subscription's current status, noting if it requires confirmation.
4037
- **Verify Authorization**: Evaluate whether the user typically engages in SNS subscription actions and if they are authorized to do so for the specified topic.
4138
- **Contextualize with Related Events**: Review related CloudTrail logs around the event time for other actions by the same user or IP address. Look for activities involving other AWS services, such as S3 or IAM, that may indicate further suspicious behavior.
42-
- **Evaluate the Subscription Endpoint**: Determine whether the email endpoint is legitimate or associated with any known entity. This may require checking internal documentation or reaching out to relevant AWS account administrators.
4339
- **Check for Publish Actions**: Investigate for any subsequent `Publish` actions on the same SNS topic that may indicate exfiltration attempts or data leakage. If Publish actions are detected, further investigate the contents of the messages.
4440
- **Review IAM Policies**: Examine the user or role's IAM policies to ensure that the subscription action is within the scope of their permissions or should be.
4541
@@ -60,7 +56,11 @@ This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-
6056
For further guidance on managing and securing SNS topics in AWS environments, refer to the [AWS SNS documentation](https://docs.aws.amazon.com/sns/latest/dg/welcome.html) and AWS best practices for security.
6157
6258
"""
63-
references = ["https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html"]
59+
references = [
60+
"https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html",
61+
"https://permiso.io/blog/s/smishing-attack-on-aws-sms-new-phone-who-dis/",
62+
"https://www.sentinelone.com/labs/sns-sender-active-campaigns-unleash-messaging-spam-through-the-cloud/",
63+
]
6464
risk_score = 21
6565
rule_id = "3df49ff6-985d-11ef-88a1-f661ea17fbcd"
6666
severity = "low"
@@ -72,6 +72,8 @@ tags = [
7272
"Resources: Investigation Guide",
7373
"Use Case: Threat Detection",
7474
"Tactic: Exfiltration",
75+
"Tactic: Collection",
76+
"Tactic: Impact",
7577
]
7678
timestamp_override = "event.ingested"
7779
type = "new_terms"
@@ -80,7 +82,7 @@ query = '''
8082
event.dataset: "aws.cloudtrail"
8183
and event.provider: "sns.amazonaws.com"
8284
and event.action: "Subscribe"
83-
and aws.cloudtrail.request_parameters: *protocol=email*
85+
and event.outcome: "success"
8486
'''
8587

8688

@@ -108,27 +110,44 @@ reference = "https://attack.mitre.org/techniques/T1530/"
108110
id = "TA0009"
109111
name = "Collection"
110112
reference = "https://attack.mitre.org/tactics/TA0009/"
113+
[[rule.threat]]
114+
framework = "MITRE ATT&CK"
115+
[[rule.threat.technique]]
116+
id = "T1496"
117+
name = "Resource Hijacking"
118+
reference = "https://attack.mitre.org/techniques/T1496/"
119+
[[rule.threat.technique.subtechnique]]
120+
id = "T1496.004"
121+
name = "Cloud Service Hijacking"
122+
reference = "https://attack.mitre.org/techniques/T1496/004/"
123+
124+
125+
126+
[rule.threat.tactic]
127+
id = "TA0040"
128+
name = "Impact"
129+
reference = "https://attack.mitre.org/tactics/TA0040/"
111130

112131
[rule.investigation_fields]
113132
field_names = [
114133
"@timestamp",
115134
"user.name",
116-
"source.address",
135+
"user_agent.original",
136+
"source.ip",
117137
"aws.cloudtrail.user_identity.arn",
118138
"aws.cloudtrail.user_identity.type",
119-
"user_agent.original",
139+
"aws.cloudtrail.user_identity.access_key_id",
120140
"event.action",
121141
"event.outcome",
142+
"cloud.account.id",
122143
"cloud.region",
123-
"aws.cloudtrail.flattened.request_parameters.protocol",
124-
"aws.cloudtrail.flattened.request_parameters.topicArn",
125-
"aws.cloudtrail.flattened.response_elements.subscriptionArn",
126144
"aws.cloudtrail.request_parameters",
145+
"aws.cloudtrail.response_elements"
127146
]
128147

129148
[rule.new_terms]
130149
field = "new_terms_fields"
131-
value = ["aws.cloudtrail.user_identity.arn"]
150+
value = ["cloud.account.id", "user.name", "aws.cloudtrail.flattened.request_parameters.protocol"]
132151
[[rule.new_terms.history_window_start]]
133152
field = "history_window_start"
134153
value = "now-14d"

rules/integrations/aws/lateral_movement_sns_topic_message_publish_by_rare_user.toml

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,41 @@
22
creation_date = "2025/01/07"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/01/07"
5+
updated_date = "2025/09/09"
66

77
[rule]
88
author = ["Elastic"]
99
description = """
1010
Identifies when an SNS topic message is published by a rare user in AWS. Adversaries may publish messages to SNS topics
1111
for phishing campaigns, data exfiltration, or lateral movement within the AWS environment. SNS topics are used to send
12-
notifications and messages to subscribed endpoints such as applications, devices or email addresses, making them a
13-
valuable target for adversaries to distribute malicious content or exfiltrate sensitive data. This is a [New
14-
Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that only flags
15-
when this behavior is observed for the first time on a user in the last 14 days.
12+
notifications and messages to subscribed endpoints such as applications, mobile devices or email addresses, making them a
13+
valuable target for adversaries to distribute malicious content or exfiltrate sensitive data. This is a New Terms rule that only flags
14+
when this behavior is observed for the first time by a user or role.
1615
"""
1716
false_positives = [
1817
"""
1918
New users or roles may legitimately publish messages to SNS topics for authorized purposes. Ensure that the action
2019
is authorized before taking action.
2120
""",
2221
]
23-
from = "now-9m"
22+
from = "now-6m"
2423
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
2524
language = "kuery"
2625
license = "Elastic License v2"
27-
name = "SNS Topic Message Publish by Rare User"
26+
name = "AWS SNS Topic Message Publish by Rare User"
2827
note = """## Triage and Analysis
2928
30-
### Investigating SNS Topic Message Publish by Rare User
29+
### Investigating AWS SNS Topic Message Publish by Rare User
3130
3231
This rule identifies when a message is published to an SNS topic by a user who has rarely or never published messages before. This activity could indicate adversarial actions, such as using SNS topics for phishing campaigns, data exfiltration, or lateral movement within an AWS environment.
3332
33+
This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that only flags when this behavior is observed for the first time by a user or role.
34+
3435
#### Possible Investigation Steps
3536
3637
- **Identify the Actor and Resource**:
37-
- **User Identity and Role**: Examine the `aws.cloudtrail.user_identity.arn` to identify the user or role responsible for publishing the SNS message. Verify whether this actor is authorized to publish messages to SNS topics. This user is considered "rare" since they have not published messages to SNS topics in the last 14 days.
38-
- **Access Key Details**: Review the `aws.cloudtrail.user_identity.access_key_id` to determine if the access key used is valid or compromised.
38+
- **User Identity and Role**: Examine the `aws.cloudtrail.user_identity.arn` to identify the user or role responsible for publishing the SNS message. Verify whether this actor is authorized to publish messages to SNS topics.
39+
- **Access Key Details**: Review the `aws.cloudtrail.user_identity.access_key_id` to determine the access key used.
3940
- **SNS Topic ARN**: Analyze `aws.cloudtrail.resources.arn` to confirm whether the SNS topic is critical, sensitive, or used for authorized purposes.
4041
4142
- **Evaluate the Context of the SNS Message**:
@@ -90,9 +91,12 @@ For more information on SNS topic management and securing AWS resources, refer t
9091
references = [
9192
"https://docs.aws.amazon.com/sns/latest/api/API_Publish.html",
9293
"https://hackingthe.cloud/aws/exploitation/Misconfigured_Resource-Based_Policies/exploting_public_resources_attack_playbook/",
94+
"https://permiso.io/blog/s/smishing-attack-on-aws-sms-new-phone-who-dis/",
95+
"https://www.sentinelone.com/labs/sns-sender-active-campaigns-unleash-messaging-spam-through-the-cloud/",
9396
]
9497
risk_score = 47
9598
rule_id = "2112ecce-cd34-11ef-873f-f661ea17fbcd"
99+
setup = "AWS SNS topic data event types need to be enabled in the CloudTrail trail configuration to capture the Publish action. Ensure that the AWS CloudTrail service is [configured](https://docs.aws.amazon.com/sns/latest/dg/logging-using-cloudtrail.html#cloudtrail-data-events) to log data events for SNS."
96100
severity = "medium"
97101
tags = [
98102
"Domain: Cloud",
@@ -103,6 +107,7 @@ tags = [
103107
"Resources: Investigation Guide",
104108
"Tactic: Lateral Movement",
105109
"Tactic: Exfiltration",
110+
"Tactic: Impact",
106111
]
107112
timestamp_override = "event.ingested"
108113
type = "new_terms"
@@ -116,24 +121,21 @@ event.dataset:"aws.cloudtrail"
116121

117122
[rule.investigation_fields]
118123
field_names = [
119-
"@timestamp",
120-
"user.name",
121-
"aws.cloudtrail.user_identity.arn",
122-
"aws.cloudtrail.user_identity.type",
123-
"aws.cloudtrail.user_identity.access_key_id",
124-
"user_agent.original",
125-
"aws.cloudtrail.flattened.request_parameters.topicArn",
126-
"event.action",
127-
"event.outcome",
128-
"cloud.region",
129-
"source.ip",
130-
"source.geo.city_name",
131-
"source.geo.region_name",
132-
"source.geo.country_name",
133-
"aws.cloudtrail.request_id",
134-
"aws.cloudtrail.resources.arn",
135-
"aws.cloudtrail.event_category",
136-
"aws.cloudtrail.response_elements.messageId"
124+
"@timestamp",
125+
"user.name",
126+
"user_agent.original",
127+
"source.ip",
128+
"aws.cloudtrail.user_identity.arn",
129+
"aws.cloudtrail.user_identity.type",
130+
"aws.cloudtrail.user_identity.access_key_id",
131+
"aws.cloudtrail.resources.arn",
132+
"aws.cloudtrail.resources.type",
133+
"event.action",
134+
"event.outcome",
135+
"cloud.account.id",
136+
"cloud.region",
137+
"aws.cloudtrail.request_parameters",
138+
"aws.cloudtrail.response_elements"
137139
]
138140

139141
[[rule.threat]]
@@ -160,12 +162,29 @@ reference = "https://attack.mitre.org/techniques/T1567/"
160162
id = "TA0010"
161163
name = "Exfiltration"
162164
reference = "https://attack.mitre.org/tactics/TA0010/"
165+
[[rule.threat]]
166+
framework = "MITRE ATT&CK"
167+
[[rule.threat.technique]]
168+
id = "T1496"
169+
name = "Resource Hijacking"
170+
reference = "https://attack.mitre.org/techniques/T1496/"
171+
[[rule.threat.technique.subtechnique]]
172+
id = "T1496.004"
173+
name = "Cloud Service Hijacking"
174+
reference = "https://attack.mitre.org/techniques/T1496/004/"
175+
176+
177+
178+
[rule.threat.tactic]
179+
id = "TA0040"
180+
name = "Impact"
181+
reference = "https://attack.mitre.org/tactics/TA0040/"
163182

164183
[rule.new_terms]
165184
field = "new_terms_fields"
166-
value = ["aws.cloudtrail.user_identity.arn"]
185+
value = ["cloud.account.id", "user.name", "aws.cloudtrail.resources.arn"]
167186
[[rule.new_terms.history_window_start]]
168187
field = "history_window_start"
169-
value = "now-14d"
188+
value = "now-10d"
170189

171190

0 commit comments

Comments
 (0)