Skip to content

Commit 94bb664

Browse files
authored
[Rule Tuning] AWS Cloudtrail Created/Updated/Suspended/Deleted (#5292)
These Cloudtrail lifecycle rules are performing as expected in telemetry, very low volume. No major changes needed - updated Descriptions and IGs - added highlighted fields - added missing tags - reduced execution windows
1 parent f02589c commit 94bb664

File tree

4 files changed

+216
-174
lines changed

4 files changed

+216
-174
lines changed

rules/integrations/aws/collection_cloudtrail_logging_created.toml

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22
creation_date = "2020/06/10"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/11/07"
66

77
[rule]
88
author = ["Elastic"]
9-
description = "Identifies the creation of an AWS log trail that specifies the settings for delivery of log data."
9+
description = """
10+
Detects creation of a new AWS CloudTrail trail via CreateTrail API. While legitimate during onboarding or auditing
11+
improvements, adversaries can create trails that write to attacker-controlled destinations, limit regions, or otherwise
12+
subvert monitoring objectives. New trails should be validated for destination ownership, encryption, multi-region
13+
coverage, and organizational scope.
14+
"""
1015
false_positives = [
1116
"""
1217
Trail creations may be made by a system or network administrator. Verify whether the user identity, user agent,
1318
and/or hostname should be making changes in your environment. Trail creations by unfamiliar users or hosts should be
1419
investigated. If known behavior is causing false positives, it can be exempted from the rule.
1520
""",
1621
]
17-
from = "now-60m"
22+
from = "now-6m"
1823
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
19-
interval = "10m"
2024
language = "kuery"
2125
license = "Elastic License v2"
2226
name = "AWS CloudTrail Log Created"
@@ -27,37 +31,40 @@ note = """## Triage and analysis
2731
2832
### Investigating AWS CloudTrail Log Created
2933
30-
AWS CloudTrail is a service that enables governance, compliance, and operational and risk auditing of your AWS account. It logs API calls and related events, providing visibility into user activity. Adversaries may create new trails to capture sensitive data or cover their tracks. The detection rule identifies successful trail creation, signaling potential unauthorized activity, aiding in early threat detection.
34+
AWS CloudTrail is a service that enables governance, compliance, and operational and risk auditing of your AWS account. It logs API calls and related events, providing visibility into user activity. Adversaries may create new trails to capture sensitive data or cover their tracks. This detection identifies
35+
`CreateTrail` calls so responders can verify destination ownership, encryption, and scope before accepting the change.
3136
32-
### Possible investigation steps
37+
#### Possible investigation steps
3338
34-
- Review the AWS CloudTrail logs to identify the user or role associated with the CreateTrail event by examining the user identity information in the event logs.
35-
- Check the time and date of the CreateTrail event to determine if it aligns with any known maintenance or administrative activities.
36-
- Investigate the configuration of the newly created trail to understand what specific log data it is set to capture and where it is being delivered.
37-
- Assess whether the trail creation was authorized by cross-referencing with change management records or by contacting relevant personnel.
38-
- Analyze other recent AWS CloudTrail events associated with the same user or role to identify any suspicious or unusual activities that may indicate malicious intent.
39-
- Evaluate the permissions and access policies of the user or role involved in the event to ensure they align with the principle of least privilege.
39+
- **Identify the actor and context**
40+
- Review `aws.cloudtrail.user_identity.arn`, `aws.cloudtrail.user_identity.type`, `user_agent.original`, `source.ip`.
41+
- Confirm a related change request exists (onboarding, architecture change).
42+
- **Validate trail configuration**
43+
- In `aws.cloudtrail.request_parameters`, verify:
44+
- `S3BucketName`/`CloudWatchLogsLogGroupArn` belong to your org (no external accounts).
45+
- `IsMultiRegionTrail=true` and `IncludeGlobalServiceEvents=true` (as per your standard).
46+
- `KmsKeyId` is an approved CMK; log file validation enabled.
47+
- **Correlate activity**
48+
- Look for `PutEventSelectors`, `PutInsightSelectors`, `StartLogging` following creation.
49+
- Check for prior enumeration: `DescribeTrails`, `ListBuckets`, `GetEventSelectors`.
4050
4151
### False positive analysis
42-
43-
- Routine administrative actions by authorized personnel can trigger this rule. Regularly review and document legitimate trail creation activities to differentiate them from unauthorized actions.
44-
- Automated processes or scripts that create trails for compliance or monitoring purposes may cause false positives. Identify and whitelist these processes to prevent unnecessary alerts.
45-
- Third-party security tools or services that integrate with AWS and create trails for enhanced logging might be mistaken for suspicious activity. Verify these integrations and exclude them from the rule if they are part of your security strategy.
46-
- Changes in organizational policy or structure that require new trail creation can lead to false positives. Ensure that such changes are communicated to the security team to adjust the rule settings accordingly.
52+
- **Planned creation**: Onboarding or compliance initiatives often add trails. Validate via ticket and standard template.
53+
- **Automation**: IaC or control-tower pipelines may create trails on account bootstrap.
4754
4855
### Response and remediation
49-
50-
- Immediately review the newly created CloudTrail log to verify its legitimacy. Check the user or service account that initiated the trail creation and confirm if it aligns with expected administrative activities.
51-
- If the trail creation is unauthorized, disable or delete the trail to prevent further data capture by potential adversaries.
52-
- Conduct a thorough audit of recent API calls and user activities associated with the account that created the trail to identify any other suspicious actions or configurations.
53-
- Escalate the incident to the security operations team for further investigation and to determine if additional AWS resources have been compromised.
54-
- Implement additional monitoring and alerting for any future unauthorized CloudTrail modifications or creations to enhance early detection capabilities.
55-
- Review and tighten IAM policies and permissions to ensure that only authorized personnel have the ability to create or modify CloudTrail configurations.
56-
- Consider enabling AWS CloudTrail log file integrity validation to ensure that log files have not been altered or deleted, providing an additional layer of security.
57-
58-
## Setup
59-
60-
The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
56+
- **If unauthorized**
57+
- Disable or delete the trail; verify and secure the destination S3/CloudWatch resources.
58+
- Review the actor’s recent changes and rotate credentials if compromise is suspected.
59+
- **Hardening**
60+
- Restrict `cloudtrail:CreateTrail` to admin roles.
61+
- Use AWS Config / Security Hub controls to enforce multi-region, global events, and validated destinations.
62+
63+
### Additional information
64+
- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
65+
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
66+
- **Security Best Practices:** [AWS Knowledge Center – Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
67+
"""
6168
references = [
6269
"https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_CreateTrail.html",
6370
"https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudtrail/create-trail.html",
@@ -69,6 +76,7 @@ tags = [
6976
"Domain: Cloud",
7077
"Data Source: AWS",
7178
"Data Source: Amazon Web Services",
79+
"Data Source: AWS Cloudtrail",
7280
"Use Case: Log Auditing",
7381
"Tactic: Collection",
7482
"Resources: Investigation Guide",
@@ -77,7 +85,10 @@ timestamp_override = "event.ingested"
7785
type = "query"
7886

7987
query = '''
80-
event.dataset:aws.cloudtrail and event.provider:cloudtrail.amazonaws.com and event.action:CreateTrail and event.outcome:success
88+
event.dataset: "aws.cloudtrail"
89+
and event.provider: "cloudtrail.amazonaws.com"
90+
and event.action: "CreateTrail"
91+
and event.outcome: "success"
8192
'''
8293

8394

@@ -94,3 +105,20 @@ id = "TA0009"
94105
name = "Collection"
95106
reference = "https://attack.mitre.org/tactics/TA0009/"
96107

108+
[rule.investigation_fields]
109+
field_names = [
110+
"@timestamp",
111+
"user.name",
112+
"user_agent.original",
113+
"source.ip",
114+
"aws.cloudtrail.user_identity.arn",
115+
"aws.cloudtrail.user_identity.type",
116+
"aws.cloudtrail.user_identity.access_key_id",
117+
"event.action",
118+
"event.outcome",
119+
"cloud.account.id",
120+
"cloud.region",
121+
"aws.cloudtrail.request_parameters",
122+
"aws.cloudtrail.response_elements",
123+
]
124+

rules/integrations/aws/defense_evasion_cloudtrail_logging_deleted.toml

Lines changed: 52 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,60 @@
22
creation_date = "2020/05/26"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2024/11/07"
5+
updated_date = "2025/11/07"
66

77
[rule]
88
author = ["Elastic"]
9-
description = "Identifies the deletion of an AWS log trail. An adversary may delete trails in an attempt to evade defenses."
9+
description = """
10+
Detects deletion of an AWS CloudTrail trail via DeleteTrail API. Removing trails is a high-risk action that destroys an
11+
audit control plane and is frequently paired with other destructive or stealthy operations. Validate immediately and
12+
restore compliant logging.
13+
"""
1014
false_positives = [
1115
"""
1216
Trail deletions may be made by a system or network administrator. Verify whether the user identity, user agent,
1317
and/or hostname should be making changes in your environment. Trail deletions by unfamiliar users or hosts should be
1418
investigated. If known behavior is causing false positives, it can be exempted from the rule.
1519
""",
1620
]
17-
from = "now-60m"
21+
from = "now-6m"
1822
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
19-
interval = "10m"
2023
language = "kuery"
2124
license = "Elastic License v2"
2225
name = "AWS CloudTrail Log Deleted"
2326
note = """## Triage and analysis
2427
25-
### Investigating AWS CloudTrail Log Deleted
28+
> **Disclaimer**:
29+
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
2630
27-
Amazon CloudTrail is a service that enables governance, compliance, operational auditing, and risk auditing of your Amazon Web Services account. With CloudTrail, you can log, continuously monitor, and retain account activity related to actions across your Amazon Web Services infrastructure. CloudTrail provides event history of your Amazon Web Services account activity, including actions taken through the Amazon Management Console, Amazon SDKs, command line tools, and other Amazon Web Services services. This event history simplifies security analysis, resource change tracking, and troubleshooting.
31+
### Investigating AWS CloudTrail Log Deleted
2832
29-
This rule identifies the deletion of an AWS log trail using the API `DeleteTrail` action. Attackers can do this to cover their tracks and impact security monitoring that relies on this source.
33+
AWS CloudTrail is a service that enables governance, compliance, and operational and risk auditing of your AWS account. It logs API calls and related events, providing visibility into user activity. This rule identifies the deletion of an AWS log trail using the `DeleteTrail` API. Deleting a trail can eliminate visibility and is a strong indicator of defense evasion or sabotage.
3034
3135
#### Possible investigation steps
32-
33-
- Identify the user account that performed the action and whether it should perform this kind of action.
34-
- Investigate other alerts associated with the user account during the past 48 hours.
35-
- Contact the account and resource owners and confirm whether they are aware of this activity.
36-
- Check if this operation was approved and performed according to the organization's change management policy.
37-
- Considering the source IP address and geolocation of the user who issued the command:
38-
- Do they look normal for the user?
39-
- If the source is an EC2 IP address, is it associated with an EC2 instance in one of your accounts or is the source IP from an EC2 instance that's not under your control?
40-
- If it is an authorized EC2 instance, is the activity associated with normal behavior for the instance role or roles? Are there any other alerts or signs of suspicious activity involving this instance?
41-
- Investigate the deleted log trail's criticality and whether the responsible team is aware of the deletion.
42-
- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.
36+
- **Actor & target**
37+
- Identify `aws.cloudtrail.user_identity.arn`, `user_agent.original`, `source.ip`.
38+
- Confirm which trail was deleted (name/ARN, multi-region/organization status) from `aws.cloudtrail.request_parameters` or `target.entity.id`.
39+
- **Blast radius**
40+
- Determine whether it was the only trail or if organization/multi-region coverage remains.
41+
- Review preceding `StopLogging` or `UpdateTrail` and subsequent high-risk actions (IAM, S3, KMS, EC2 exports).
42+
- **Data preservation**
43+
- Verify S3 destinations and CloudWatch log groups for retained historical logs and file integrity validation.
4344
4445
### False positive analysis
45-
46-
- If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and IP address conditions.
46+
- **Planned deletion**: Validate with tickets and decommissioning plans; ensure replacement/alternate trails exist.
4747
4848
### Response and remediation
49-
50-
- Initiate the incident response process based on the outcome of the triage.
51-
- Disable or limit the account during the investigation and response.
52-
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
53-
- Identify the account role in the cloud environment.
54-
- Assess the criticality of affected services and servers.
55-
- Work with your IT team to identify and minimize the impact on users.
56-
- Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
57-
- Identify any regulatory or legal ramifications related to this activity.
58-
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
59-
- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
60-
- Consider enabling multi-factor authentication for users.
61-
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
62-
- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
63-
- Take the actions needed to return affected systems, data, or services to their normal operational levels.
64-
- Identify the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
65-
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
66-
67-
## Setup
68-
69-
The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
49+
- Recreate or re-enable compliant multi-region (or organization) trails immediately.
50+
- Investigate the actor’s recent activity; rotate creds if compromise is suspected.
51+
- Validate destination bucket policies, CMK policies, and event selectors for all active trails.
52+
- Hardening: Restrict `cloudtrail:DeleteTrail` and enforce guardrails via AWS Config/SCPs; alert on future deletions.
53+
54+
### Additional information
55+
- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
56+
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
57+
- **Security Best Practices:** [AWS Knowledge Center – Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
58+
"""
7059
references = [
7160
"https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_DeleteTrail.html",
7261
"https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudtrail/delete-trail.html",
@@ -78,6 +67,7 @@ tags = [
7867
"Domain: Cloud",
7968
"Data Source: AWS",
8069
"Data Source: Amazon Web Services",
70+
"Data Source: AWS Cloudtrail",
8171
"Use Case: Log Auditing",
8272
"Resources: Investigation Guide",
8373
"Tactic: Defense Evasion",
@@ -86,26 +76,12 @@ timestamp_override = "event.ingested"
8676
type = "query"
8777

8878
query = '''
89-
event.dataset:aws.cloudtrail
90-
and event.provider:cloudtrail.amazonaws.com
91-
and event.action:DeleteTrail
92-
and event.outcome:success
79+
event.dataset: "aws.cloudtrail"
80+
and event.provider: "cloudtrail.amazonaws.com"
81+
and event.action: "DeleteTrail"
82+
and event.outcome: "success"
9383
'''
9484

95-
[rule.investigation_fields]
96-
field_names = [
97-
"@timestamp",
98-
"user.name",
99-
"aws.cloudtrail.user_identity.arn",
100-
"aws.cloudtrail.user_identity.type",
101-
"source.address",
102-
"user_agent.original",
103-
"aws.cloudtrail.flattened.request_parameters.name",
104-
"event.action",
105-
"event.outcome",
106-
"cloud.region",
107-
"aws.cloudtrail.request_parameters"
108-
]
10985

11086
[[rule.threat]]
11187
framework = "MITRE ATT&CK"
@@ -125,3 +101,20 @@ id = "TA0005"
125101
name = "Defense Evasion"
126102
reference = "https://attack.mitre.org/tactics/TA0005/"
127103

104+
[rule.investigation_fields]
105+
field_names = [
106+
"@timestamp",
107+
"user.name",
108+
"user_agent.original",
109+
"source.ip",
110+
"aws.cloudtrail.user_identity.arn",
111+
"aws.cloudtrail.user_identity.type",
112+
"aws.cloudtrail.user_identity.access_key_id",
113+
"target.entity.id",
114+
"event.action",
115+
"event.outcome",
116+
"cloud.account.id",
117+
"cloud.region",
118+
"aws.cloudtrail.request_parameters",
119+
]
120+

0 commit comments

Comments
 (0)