Skip to content

Commit c04ae6d

Browse files
[New Rule] Adding Coverage for SNS Topic Message Publish by Rare User (#4350)
* new rule 'SNS Topic Message Publish by Rare User' * added new terms note * added investigation guide tag * fixed tag, added investigation fiedls * toml lint * fixed mitre ATT&CK mapping
1 parent 97b3f43 commit c04ae6d

File tree

1 file changed

+171
-0
lines changed

1 file changed

+171
-0
lines changed
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
[metadata]
2+
creation_date = "2025/01/07"
3+
integration = ["aws"]
4+
maturity = "production"
5+
updated_date = "2025/01/07"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
Identifies when an SNS topic message is published by a rare user in AWS. Adversaries may publish messages to SNS topics
11+
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.
16+
"""
17+
false_positives = [
18+
"""
19+
New users or roles may legitimately publish messages to SNS topics for authorized purposes. Ensure that the action
20+
is authorized before taking action.
21+
""",
22+
]
23+
from = "now-9m"
24+
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
25+
language = "kuery"
26+
license = "Elastic License v2"
27+
name = "SNS Topic Message Publish by Rare User"
28+
note = """## Triage and Analysis
29+
30+
### Investigating SNS Topic Message Publish by Rare User
31+
32+
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.
33+
34+
#### Possible Investigation Steps
35+
36+
- **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.
39+
- **SNS Topic ARN**: Analyze `aws.cloudtrail.resources.arn` to confirm whether the SNS topic is critical, sensitive, or used for authorized purposes.
40+
41+
- **Evaluate the Context of the SNS Message**:
42+
- **Published Message Details**: AWS redacts the message content in CloudTrail logs, but you can view the message ID, subject, and other metadata. Investigate the message details for any indicators of malicious content.
43+
- **Message Recipients**: Investigate the subscriptions associated with the SNS topic to identify if messages were sent to unauthorized or unexpected recipients.
44+
45+
- **Analyze Source Information**:
46+
- **Source IP Address**: Examine the `source.ip` field to identify the origin of the activity. Unusual IP addresses or geolocations may indicate unauthorized access.
47+
- **User Agent**: Review `user_agent.original` to determine the tool or client used for publishing the SNS message. Automated tools or unexpected clients (e.g., `Boto3` from an unknown host) may signify misuse.
48+
49+
- **Review Historical Activity**:
50+
- **Actor’s Past Behavior**: Identify whether the user has published messages to SNS topics before. Review similar past events for context.
51+
- **Frequency and Patterns**: Examine the time and frequency of messages published by the same user or to the same SNS topic to detect anomalies.
52+
53+
- **Correlate with Other Events**:
54+
- **IAM or CloudTrail Events**: Look for events such as `AssumeRole`, `CreateAccessKey`, or other API actions associated with the same user ARN.
55+
- **Unusual IAM Role Activity**: Determine if the actor has assumed roles or performed administrative tasks atypical for their role.
56+
57+
### False Positive Analysis
58+
59+
- **Routine Operational Use**:
60+
- Confirm if the publishing activity aligns with standard operational tasks or automation scripts.
61+
- Validate whether new or rare users were recently granted permissions for publishing messages to SNS topics.
62+
63+
- **Testing or Monitoring Scripts**:
64+
- Automated testing or monitoring tools may trigger this rule if configured to publish messages to SNS topics.
65+
66+
### Response and Remediation
67+
68+
- **Immediate Action**:
69+
- If unauthorized activity is confirmed, disable the access key or IAM role associated with the user.
70+
- Restrict or remove permissions from the SNS topic to prevent further misuse.
71+
72+
- **Review Policies and Subscriptions**:
73+
- Audit the IAM policies tied to the user and SNS topic to ensure appropriate permissions.
74+
- Validate the subscriptions of the SNS topic to confirm all endpoints are authorized.
75+
76+
- **Enhance Monitoring and Alerting**:
77+
- Set up additional logging or alerting for SNS publish actions, especially from rare or unknown users.
78+
- Monitor for similar actions across other SNS topics within the environment.
79+
80+
- **Conduct a Root Cause Analysis**:
81+
- Investigate how the user or role gained access to publish messages to the SNS topic.
82+
- Determine if other AWS resources or services have been affected.
83+
84+
### Additional Information
85+
86+
For more information on SNS topic management and securing AWS resources, refer to:
87+
- [AWS SNS Publish API Documentation](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html)
88+
- [AWS CloudTrail Documentation](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference.html)
89+
"""
90+
references = [
91+
"https://docs.aws.amazon.com/sns/latest/api/API_Publish.html",
92+
"https://hackingthe.cloud/aws/exploitation/Misconfigured_Resource-Based_Policies/exploting_public_resources_attack_playbook/",
93+
]
94+
risk_score = 47
95+
rule_id = "2112ecce-cd34-11ef-873f-f661ea17fbcd"
96+
severity = "medium"
97+
tags = [
98+
"Domain: Cloud",
99+
"Data Source: AWS",
100+
"Data Source: Amazon Web Services",
101+
"Data Source: AWS SNS",
102+
"Use Case: Threat Detection",
103+
"Resources: Investigation Guide",
104+
"Tactic: Lateral Movement",
105+
"Tactic: Exfiltration",
106+
]
107+
timestamp_override = "event.ingested"
108+
type = "new_terms"
109+
110+
query = '''
111+
event.dataset:"aws.cloudtrail"
112+
and event.provider:"sns.amazonaws.com"
113+
and event.action:"Publish"
114+
and event.outcome:"success"
115+
'''
116+
117+
[rule.investigation_fields]
118+
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"
137+
]
138+
139+
[[rule.threat]]
140+
framework = "MITRE ATT&CK"
141+
[[rule.threat.technique]]
142+
id = "T1534"
143+
name = "Internal Spearphishing"
144+
reference = "https://attack.mitre.org/techniques/T1534/"
145+
146+
147+
[rule.threat.tactic]
148+
id = "TA0008"
149+
name = "Lateral Movement"
150+
reference = "https://attack.mitre.org/tactics/TA0008/"
151+
[[rule.threat]]
152+
framework = "MITRE ATT&CK"
153+
[[rule.threat.technique]]
154+
id = "T1567"
155+
name = "Exfiltration Over Web Service"
156+
reference = "https://attack.mitre.org/techniques/T1567/"
157+
158+
159+
[rule.threat.tactic]
160+
id = "TA0010"
161+
name = "Exfiltration"
162+
reference = "https://attack.mitre.org/tactics/TA0010/"
163+
164+
[rule.new_terms]
165+
field = "new_terms_fields"
166+
value = ["aws.cloudtrail.user_identity.arn"]
167+
[[rule.new_terms.history_window_start]]
168+
field = "history_window_start"
169+
value = "now-14d"
170+
171+

0 commit comments

Comments
 (0)