Skip to content

Commit f486571

Browse files
[New Rule] Adding Coverage for AWS SSM Command Document Created by Rare User (#4229)
* new rule 'AWS SSM Command Document Created by Rare User' * added another reference * added investigation guide * removed min-stack * Update rules/integrations/aws/execution_ssm_command_document_created_by_rare_user.toml
1 parent 1c9177e commit f486571

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
[metadata]
2+
creation_date = "2024/11/01"
3+
integration = ["aws"]
4+
maturity = "production"
5+
updated_date = "2024/11/01"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
Identifies when an AWS Systems Manager (SSM) command document is created by a user who does not typically perform this action. Adversaries may create SSM command documents to execute commands on managed instances, potentially leading to unauthorized access, command and control, data exfiltration and more.
11+
"""
12+
false_positives = [
13+
"""
14+
Legitimate users may create SSM command documents for legitimate purposes. Ensure that the document is authorized and the user is known before taking action.
15+
""",
16+
]
17+
from = "now-9m"
18+
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
19+
language = "kuery"
20+
license = "Elastic License v2"
21+
name = "AWS SSM Command Document Created by Rare User"
22+
note = """
23+
## Triage and Analysis
24+
25+
### Investigating AWS SSM Command Document Created by Rare User
26+
27+
This rule identifies when an AWS Systems Manager (SSM) command document is created by a user who does not typically perform this action. Creating SSM command documents can be a legitimate action but may also indicate malicious intent if done by an unusual or compromised user. Adversaries may leverage SSM documents to execute commands on managed instances, potentially leading to unauthorized access, command and control, or data exfiltration.
28+
29+
#### Possible Investigation Steps
30+
31+
- **Identify the Actor**: Review the `aws.cloudtrail.user_identity.arn` field to identify who created the SSM document. Verify if this user typically creates such documents and has the appropriate permissions. It may be unexpected for certain types of users, like assumed roles or federated users, to perform this action.
32+
- **Analyze the Document Details**:
33+
- **Document Name**: Check the `aws.cloudtrail.request_parameters.name` field for the document name to understand its intended purpose.
34+
- **Document Content**: If possible, review `aws.cloudtrail.request_parameters.content` for any sensitive or unexpected instructions (e.g., actions for data exfiltration or privilege escalation). If not available via logs, consider reviewing the document in the AWS Management Console.
35+
- **Contextualize the Activity with Related Events**: Look for other CloudTrail events involving the same user ARN or IP address (`source.address`). Examine actions performed in other AWS services, such as IAM, EC2, or S3, to identify if additional suspicious behavior exists. The `SendCommand` API call may indicate attempts to execute the SSM document on managed instances.
36+
- **Check Document Status and Metadata**:
37+
- **Document Status**: Confirm the document creation status in `aws.cloudtrail.response_elements.documentDescription.status`. A status of `Creating` may indicate that the document is in progress.
38+
- **Execution Permissions**: Review if the document specifies `platformTypes` and `documentVersion` in `aws.cloudtrail.response_elements.documentDescription` to understand which environments may be impacted and if multiple versions exist.
39+
40+
### False Positive Analysis
41+
42+
- **Authorized Administrative Actions**: Determine if this document creation aligns with scheduled administrative tasks or actions by authorized personnel.
43+
- **Historical User Actions**: Compare this action against historical activities for the user to determine if they have a history of creating similar documents, which may indicate legitimate usage.
44+
45+
### Response and Remediation
46+
47+
- **Immediate Document Review and Deletion**: If the document creation is deemed unauthorized, delete the document immediately and check for other similar documents created recently.
48+
- **Enhance Monitoring and Alerts**: Configure additional monitoring for SSM document creation events, especially when associated with untrusted or rare users.
49+
- **Policy Update**: Consider restricting SSM document creation permissions to specific, trusted roles or users to prevent unauthorized document creation.
50+
- **Incident Response**: If the document is confirmed as part of malicious activity, treat this as a security incident. Follow incident response protocols, including containment, investigation, and remediation.
51+
52+
### Additional Information
53+
54+
For further guidance on managing and securing AWS Systems Manager in your environment, refer to the [AWS SSM documentation](https://docs.aws.amazon.com/systems-manager/latest/userguide/what-is-systems-manager.html) and AWS security best practices.
55+
"""
56+
references = [
57+
"https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_CreateDocument.html",
58+
"https://docs.aws.amazon.com/systems-manager/latest/userguide/documents.html"
59+
]
60+
risk_score = 21
61+
rule_id = "50a2bdea-9876-11ef-89db-f661ea17fbcd"
62+
severity = "low"
63+
tags = [
64+
"Domain: Cloud",
65+
"Data Source: AWS",
66+
"Data Source: Amazon Web Services",
67+
"Data Source: AWS SNS",
68+
"Data Source: AWS Systems Manager",
69+
"Resources: Investigation Guide",
70+
"Use Case: Threat Detection",
71+
"Tactic: Execution"
72+
]
73+
timestamp_override = "event.ingested"
74+
type = "new_terms"
75+
76+
query = '''
77+
event.dataset: "aws.cloudtrail"
78+
and event.provider: "ssm.amazonaws.com"
79+
and event.action: "CreateDocument"
80+
and event.outcome: "success"
81+
and aws.cloudtrail.response_elements: *documentType=Command*
82+
'''
83+
84+
[[rule.threat]]
85+
framework = "MITRE ATT&CK"
86+
87+
[rule.threat.tactic]
88+
id = "TA0002"
89+
name = "Execution"
90+
reference = "https://attack.mitre.org/tactics/TA0002/"
91+
92+
[rule.new_terms]
93+
field = "new_terms_fields"
94+
value = ["aws.cloudtrail.user_identity.arn"]
95+
[[rule.new_terms.history_window_start]]
96+
field = "history_window_start"
97+
value = "now-14d"

0 commit comments

Comments
 (0)