[Rule Tunings] AWS CloudWatch Deletion Rules (#5316)

Noticed some false positives in alert telemetry leading to high alert volume. For all 3 rules I've added `source.ip:*` and excluded `user_agent.original: AWS Internal` to reduce noise from internal AWS services and backend API calls made on a user's behalf. These rules will instead stay focused on direct SDK/CLI triggered API calls.

- reduced execution window
- updated description, false positive and investigation guide sections
- added highlighted fields
- udpated tags and MITRE mapping
This commit is contained in:
Isai
2025-11-24 10:49:17 -05:00
committed by GitHub
parent 7b2c02f69b
commit 534d302758
3 changed files with 323 additions and 129 deletions
@@ -2,77 +2,108 @@
creation_date = "2020/06/15"
integration = ["aws"]
maturity = "production"
updated_date = "2024/05/21"
updated_date = "2025/11/13"
[rule]
author = ["Elastic"]
description = "Identifies the deletion of an AWS CloudWatch alarm. An adversary may delete alarms in an attempt to evade defenses."
description = """
Detects the deletion of one or more Amazon CloudWatch alarms using the "DeleteAlarms" API. CloudWatch alarms are
critical for monitoring metrics and triggering alerts when thresholds are exceeded. An adversary may delete alarms to
impair visibility, silence alerts, and evade detection following malicious activity. This behavior may occur during
post-exploitation or cleanup phases to remove traces of compromise or disable automated responses.
"""
false_positives = [
"""
Verify whether the user identity, user agent, and/or hostname should be making changes in your environment. Alarm
deletions by unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can
be exempted from the rule.
CloudWatch alarm deletions can occur legitimately during scheduled maintenance, infrastructure redeployments, or
automation workflows that clean up temporary monitoring configurations. Verify that the user identity, role, and IP
address are expected for the environment. If deletions are performed by CI/CD pipelines or authorized administrators
during controlled operations, consider adding exceptions based on specific IAM roles, automation accounts, or IP
address ranges.
""",
]
from = "now-60m"
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
interval = "10m"
language = "kuery"
license = "Elastic License v2"
name = "AWS CloudWatch Alarm Deletion"
note = """## Triage and analysis
> **Disclaimer**:
> 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, validate and adapt it to your operational context.
### Investigating AWS CloudWatch Alarm Deletion
Amazon CloudWatch is a monitoring and observability service that collects monitoring and operational data in the form of
logs, metrics, and events for resources and applications. This data can be used to detect anomalous behavior in your environments, set alarms, visualize
logs and metrics side by side, take automated actions, troubleshoot issues, and discover insights to keep your
applications running smoothly.
Amazon CloudWatch is a monitoring and observability service that collects monitoring and operational data in the form of logs, metrics, and events for resources and applications. This data can be used to detect anomalous behavior in your environments, set alarms, visualize logs and metrics side by side, take automated actions, troubleshoot issues, and discover insights to keep your applications running smoothly.
CloudWatch Alarms is a feature that allows you to watch CloudWatch metrics and to receive notifications when the metrics
fall outside of the levels (high or low thresholds) that you configure.
Amazon CloudWatch Alarms monitor key metrics and trigger automated alerts or remediation workflows. Deleting these alarms disables monitoring of associated metrics and can delay detection of performance degradation or security incidents. Attackers may delete alarms to evade detection, suppress alerts, or disable security automation that responds to anomalies or policy violations.
This rule looks for the deletion of a alarm using the API `DeleteAlarms` action. Attackers can do this to cover their
tracks and evade security defenses.
This rule detects successful calls to the `DeleteAlarms` API via CloudTrail. These events should be rare and always associated with a valid change-control request or automation pipeline.
#### Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Investigate other alerts associated with the user account during the past 48 hours.
- Contact the account and resource owners and confirm whether they are aware of this activity.
- Check if there is a justification for this behavior.
- Considering the source IP address and geolocation of the user who issued the command:
- Do they look normal for the user?
- 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?
- 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?
- 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.
- **Identify the actor**
- Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id` to determine who initiated the deletion.
- Check whether this actor typically performs CloudWatch management or automation tasks.
- **Review request details**
- Inspect `aws.cloudtrail.request_parameters` or `target.entity.id` for the specific alarm names deleted.
- Determine whether the alarms were security-related (e.g., CloudTrail log delivery, GuardDuty finding rate, or IAM API monitoring alarms).
- Cross-reference deleted alarms with your organization's list of critical monitoring configurations.
- **Analyze source and context**
- Review `source.ip` and `user_agent.original` for anomalies such as external IPs, unusual user agents, or custom SDKs.
- Determine whether the activity occurred during a known maintenance window or from a trusted automation host.
- Examine `cloud.region` to identify whether alarms were deleted from unexpected regions.
- **Correlate with surrounding events**
- Review CloudTrail events for related activity around the same time, such as:
- `PutMetricAlarm`, `DisableAlarmActions`, or `DeleteLogGroup`
- Changes to CloudTrail, Config, or GuardDuty configurations
- IAM policy or permission modifications that could facilitate evasion
- Identify whether the same actor has previously modified logging or monitoring infrastructure.
- **Assess impact and scope**
- Determine which systems or detection workflows relied on the deleted alarms.
- Review whether the deletion affected automated responses, notifications, or third-party integrations (e.g., SNS, Lambda, or PagerDuty).
### False positive analysis
- 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.
- **Legitimate automation or redeployment**
- Infrastructure as Code (IaC) frameworks such as Terraform or CloudFormation may delete and recreate alarms during updates.
- Validate automation account roles and ensure alarm deletions are immediately followed by re-creation actions.
- **Operational maintenance**
- Scheduled monitoring cleanup, regional deactivation, or test environment resets can trigger legitimate deletions.
- Verify timing and user identity against approved change management records.
- **Organizational migrations**
- Security operations or DevOps teams may consolidate alarms during account merges or refactors.
- Confirm intent with relevant teams and exclude authorized administrative accounts as necessary.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
- Identify the account role in the cloud environment.
- Assess the criticality of affected services and servers.
- Work with your IT team to identify and minimize the impact on users.
- Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
- Identify any regulatory or legal ramifications related to this activity.
- 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.
- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
- Consider enabling multi-factor authentication for users.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
- Take the actions needed to return affected systems, data, or services to their normal operational levels.
- Identify the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- 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).
- **Containment**
- If the deletion was unauthorized, recreate the deleted alarms immediately using IaC templates or CloudFormation backups.
- Re-enable any dependent automation or alerts that rely on those alarms.
- Temporarily restrict CloudWatch modification privileges to designated IAM roles.
## Setup
- **Investigation**
- Review related CloudTrail logs for preceding IAM changes, STS activity, or anomalous role assumptions that might indicate compromised credentials.
- Investigate whether any alerts were suppressed or delayed prior to the deletion.
The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
- **Recovery and hardening**
- Implement AWS Config rules to continuously monitor alarm existence and alert on `DeleteAlarms` API calls.
- Restrict permissions to `cloudwatch:DeleteAlarms` and enforce MFA for users performing monitoring configuration changes.
- Maintain IaC definitions for all critical alarms to support rapid restoration.
- Audit IAM roles and automation accounts that manage CloudWatch configurations to ensure least privilege.
- Integrate alarm configuration checks into your CI/CD validation workflows.
### Additional information
- **[AWS Config Rule cloudwatch-alarm-action-check](https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-action-check.html)**
- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
- **Security Best Practices:** [AWS Knowledge Center Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
"""
references = [
"https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudwatch/delete-alarms.html",
"https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DeleteAlarms.html",
@@ -84,6 +115,7 @@ tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: Amazon CloudWatch",
"Resources: Investigation Guide",
"Tactic: Defense Evasion",
]
@@ -91,7 +123,12 @@ timestamp_override = "event.ingested"
type = "query"
query = '''
event.dataset:aws.cloudtrail and event.provider:monitoring.amazonaws.com and event.action:DeleteAlarms and event.outcome:success
event.dataset: "aws.cloudtrail"
and event.provider: "monitoring.amazonaws.com"
and event.action: "DeleteAlarms"
and event.outcome: "success"
and source.ip: *
and not user_agent.original : "AWS Internal"
'''
@@ -106,6 +143,11 @@ id = "T1562.001"
name = "Disable or Modify Tools"
reference = "https://attack.mitre.org/techniques/T1562/001/"
[[rule.threat.technique.subtechnique]]
id = "T1562.006"
name = "Indicator Blocking"
reference = "https://attack.mitre.org/techniques/T1562/006/"
[rule.threat.tactic]
@@ -113,3 +155,20 @@ id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.access_key_id",
"target.entity.id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
]
@@ -2,76 +2,127 @@
creation_date = "2020/05/18"
integration = ["aws"]
maturity = "production"
updated_date = "2024/05/21"
updated_date = "2025/11/13"
[rule]
author = ["Elastic"]
description = """
Identifies the deletion of a specified AWS CloudWatch log group. When a log group is deleted, all the archived log
events associated with the log group are also permanently deleted.
Detects the deletion of an Amazon CloudWatch Log Group using the "DeleteLogGroup" API. CloudWatch log groups store
operational and security logs for AWS services and custom applications. Deleting a log group permanently removes all
associated log streams and historical log data, which can eliminate forensic evidence and disrupt security monitoring
pipelines. Adversaries may delete log groups to conceal malicious activity, disable log forwarding, or impede incident
response.
"""
false_positives = [
"""
Verify whether the user identity, user agent, and/or hostname should be making changes in your environment. Log
group deletions by unfamiliar users or hosts should be investigated. If known behavior is causing false positives,
it can be exempted from the rule.
CloudWatch log group deletions may occur during normal maintenance or infrastructure re-deployments, especially in
environments managed by IaC tools (e.g., Terraform, CloudFormation, CDK). Automation pipelines may recreate log
groups as part of expected workflows. Verify that the identity, user agent, and source IP match approved
administrative or automation activity. If deletions are routine for specific automation roles or CI/CD hosts,
consider adding scoped exceptions.
""",
]
from = "now-60m"
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
interval = "10m"
language = "kuery"
license = "Elastic License v2"
name = "AWS CloudWatch Log Group Deletion"
note = """## Triage and analysis
> **Disclaimer**:
> 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, validate and adapt it to your operational context.
### Investigating AWS CloudWatch Log Group Deletion
Amazon CloudWatch is a monitoring and observability service that collects monitoring and operational data in the form of logs, metrics, and events for resources and applications. This data can be used to detect anomalous behavior in your environments, set alarms, visualize logs and metrics side by side, take automated actions, troubleshoot issues, and discover insights to keep your applications running smoothly.
CloudWatch Logs is foundational to AWS observability, SIEM ingestion, audit pipelines, and incident response.
Log groups often contain retention-critical logs such as:
A log group is a group of log streams that share the same retention, monitoring, and access control settings. You can define log groups and specify which streams to put into each group. There is no limit on the number of log streams that can belong to one log group.
- VPC Flow Logs
- Lambda function logs
- Application and container logs
- Security service logs (e.g., AWS WAF, RDS logs)
This rule looks for the deletion of a log group using the API `DeleteLogGroup` action. Attackers can do this to cover their tracks and impact security monitoring that relies on these sources.
Deletion of a log group removes all historical log streams and cannot be reversed.
Adversaries may leverage `DeleteLogGroup` to impair forensic visibility, disrupt monitoring, and hide evidence following malicious actions. This rule detects a successful `DeleteLogGroup` event initiated from a nonAWS Internal user agent, signalling potential defense evasion or disruption of logging pipelines.
#### Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Investigate other alerts associated with the user account during the past 48 hours.
- Contact the account and resource owners and confirm whether they are aware of this activity.
- Check if this operation was approved and performed according to the organization's change management policy.
- Considering the source IP address and geolocation of the user who issued the command:
- Do they look normal for the user?
- 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?
- 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?
- Investigate the deleted log group's criticality and whether the responsible team is aware of the deletion.
- 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.
**Identify the actor**
- Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id`.
- Determine whether this identity normally modifies CloudWatch Logs or is associated with automation.
**Review deletion details**
- Inspect `aws.cloudtrail.request_parameters` or `target.entity.id` to determine the exact log group deleted.
- Assess whether the log group provided visibility into:
- CloudTrail processing,
- Network flows (VPC Flow Logs),
- Serverless/application security logs,
- Lambda, ECS, EKS, or container workload logs.
**Check source and context**
- Assess `source.ip` for unusual IPs, geolocations, VPN endpoints, or cloud provider ranges unfamiliar to your environment.
- Review `user_agent.original` for unexpected tools (custom agents, unusual SDKs, attackers using CLI default agents).
**Correlate with surrounding activity**
Look for preceding or subsequent CloudTrail events such as:
- `StopLogging`, `DeleteTrail`, or CloudTrail configuration changes
- IAM permission escalations (e.g., `PutUserPolicy`, `AttachRolePolicy`)
- Security service suppression actions (e.g., GuardDuty detector deletion)
- Lambda or application configuration updates that may indicate a compromise
If the deleted log group was associated with a Lambda execution role, review for suspicious code updates or rogue deployments.
**Assess business or security impact**
- Identify whether the deleted log group fed:
- SIEM ingestion
- Security analytics pipelines
- Compliance/audit logs
- Operational monitoring or alerting
- Contact the service owner or development team to verify whether the deletion was intentional.
**Determine compromise scope if malicious**
- Use CloudTrail to identify prior activity by the same user identity or IP.
- Examine authentication events (IAM, STS) for signs of stolen credentials or session hijacking.
- Identify resources or applications dependent on the deleted logging pipeline.
### False positive analysis
- 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.
- **IaC-managed environments**: Tools like Terraform or CloudFormation may delete and recreate log groups during deployments.
- **Automated cleanup jobs**: Some environments use automated retention cleanup workflows.
- **Ephemeral testing accounts**: Development/testing accounts frequently create and destroy log groups.
To tune noise:
- Add exceptions for specific automation IAM roles or trusted source IPs.
- Require `user_agent.original` and `source.ip` conditions for baseline-based tuning.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
- Identify the account role in the cloud environment.
- Assess the criticality of affected services and servers.
- Work with your IT team to identify and minimize the impact on users.
- Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
- Identify any regulatory or legal ramifications related to this activity.
- 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.
- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
- Consider enabling multi-factor authentication for users.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
- Take the actions needed to return affected systems, data, or services to their normal operational levels.
- Identify the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- 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).
**Containment**
- Immediately recreate the deleted log group (if appropriate) using IaC or CloudWatch Console.
- Restrict the IAM identity that performed the deletion until the activity is validated.
- Enable or confirm CloudTrail logging in all regions to maintain broader visibility.
## Setup
**Investigation**
- Review CloudTrail activity for:
- privilege escalation attempts,
- IAM role modifications,
- security service tampering (CloudTrail, Config, GuardDuty).
- Correlate with alerts from other services (GuardDuty, Security Hub, SIEM detections).
The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
**Recovery and hardening**
- Enforce least privilege on `logs:DeleteLogGroup`.
- Configure AWS Config rules to alert on missing or modified log groups.
- Implement log group retention policies and IAM SCP guardrails to prevent unauthorized deletion.
- Document log group ownership and expected lifecycle management.
### Additional information
- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
- **Security Best Practices:** [AWS Knowledge Center Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
"""
references = [
"https://awscli.amazonaws.com/v2/documentation/api/latest/reference/logs/delete-log-group.html",
"https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DeleteLogGroup.html",
@@ -83,16 +134,22 @@ tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS CloudWatch",
"Data Source: Amazon CloudWatch",
"Use Case: Log Auditing",
"Resources: Investigation Guide",
"Tactic: Defense Evasion",
"Tactic: Impact",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.dataset:aws.cloudtrail and event.provider:logs.amazonaws.com and event.action:DeleteLogGroup and event.outcome:success
event.dataset: "aws.cloudtrail"
and event.provider: "logs.amazonaws.com"
and event.action: "DeleteLogGroup"
and event.outcome: "success"
and source.ip: *
and not user_agent.original : "AWS Internal"
'''
@@ -126,3 +183,20 @@ id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.access_key_id",
"target.entity.id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
]
@@ -2,76 +2,114 @@
creation_date = "2020/05/20"
integration = ["aws"]
maturity = "production"
updated_date = "2024/05/21"
updated_date = "2025/11/13"
[rule]
author = ["Elastic"]
description = """
Identifies the deletion of an AWS CloudWatch log stream, which permanently deletes all associated archived log events
with the stream.
Detects the deletion of an Amazon CloudWatch log stream using the "DeleteLogStream" API. Deleting a log stream
permanently removes its associated log events and may disrupt security visibility, break audit trails, or suppress
forensic evidence. Adversaries may delete log streams to conceal malicious actions, impair monitoring pipelines, or
remove artifacts generated during post-exploitation activity.
"""
false_positives = [
"""
A log stream may be deleted by a system administrator. Verify whether the user identity, user agent, and/or hostname
should be making changes in your environment. Log stream deletions by unfamiliar users or hosts should be
investigated. If known behavior is causing false positives, it can be exempted from the rule.
CloudWatch log streams may be deleted legitimately during log rotation processes, test environment resets, or
infrastructure deployments that recreate log groups and streams. Validate the identity, automation pipeline, and IP
address associated with the deletion. If deletions are expected from specific CI/CD systems or administrative roles,
consider adding targeted exceptions.
""",
]
from = "now-60m"
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
interval = "10m"
language = "kuery"
license = "Elastic License v2"
name = "AWS CloudWatch Log Stream Deletion"
note = """## Triage and analysis
> **Disclaimer**:
> 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, validate and adapt it to your operational context.
### Investigating AWS CloudWatch Log Stream Deletion
Amazon CloudWatch is a monitoring and observability service that collects monitoring and operational data in the form of logs, metrics, and events for resources and applications. This data can be used to detect anomalous behavior in your environments, set alarms, visualize logs and metrics side by side, take automated actions, troubleshoot issues, and discover insights to keep your applications running smoothly.
CloudWatch log streams contain sequential log events from a single application, service, or AWS resource.
Deleting a log stream permanently removes its archived log events, which may disable monitoring workflows, eliminate
critical telemetry, or disrupt forensic visibility.
A log stream is a sequence of log events that share the same source. Each separate source of logs in CloudWatch Logs makes up a separate log stream.
This rule looks for the deletion of a log stream using the API `DeleteLogStream` action. Attackers can do this to cover their tracks and impact security monitoring that relies on these sources.
Adversaries may delete log streams to cover their tracks after unauthorized actions, break ingestion pipelines feeding SIEM, alerting, or anomaly detection or to remove evidence before escalating privileges or moving laterally. This rule detects successful invocations of the `DeleteLogStream` API from CloudTrail.
#### Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Investigate other alerts associated with the user account during the past 48 hours.
- Contact the account and resource owners and confirm whether they are aware of this activity.
- Check if this operation was approved and performed according to the organization's change management policy.
- Considering the source IP address and geolocation of the user who issued the command:
- Do they look normal for the calling user?
- 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?
- 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?
- Investigate the deleted log stream's criticality and whether the responsible team is aware of the deletion.
- 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.
- **Identify the actor**
- Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id`.
- Confirm whether the user or role normally manages CloudWatch Logs resources.
- **Review request details**
- Inspect `aws.cloudtrail.request_parameters` to determine which log stream and parent log group were deleted.
- Assess the importance of the deleted stream:
- Was it used for VPC Flow Logs, CloudTrail, Lambda functions, ECS tasks, or application logs?
- Did it contain logs used for security detection or compliance auditing?
- **Examine request origin and context**
- Review `source.ip` and `user_agent.original` for anomalies (e.g., unfamiliar CLI tools, suspicious automation,
unknown IP ranges, or external geolocations).
- Validate whether the request originated from a legitimate automation host or jump box.
- Check activity around the same timestamp for related operations such as:
- `DeleteLogGroup`
- `StopLogging`, `UpdateTrail`, or `DeleteTrail`
- GuardDuty detector or CloudWatch alarm deletions
- IAM policy or role modifications
- **Determine operational justification**
- Consult change management systems or deployment pipelines to confirm whether the deletion was planned.
- Contact application owners or platform teams to determine whether the log stream was part of normal rotation or cleanup.
- **Investigate broader compromise indicators**
- Look for suspicious activity by the same identity in the past 2448 hours, such as:
- Failed authentication attempts
- IAM privilege escalations
- Unusual STS AssumeRole usage
- Access from new geolocations
### False positive analysis
- 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.
- **Log rotation and automation**
- Some systems delete log streams automatically when rolling new deployments or recycling compute resources.
- CI/CD pipelines managing immutable infrastructure may delete and recreate streams during each deploy.
- **Test and development accounts**
- Dev/test environments may frequently create and delete log streams as part of iterative work.
- **Bulk cleanup operations**
- Platform engineering teams may delete obsolete log streams during cost-optimization or log-retention management.
If the rule triggers frequently from known infrastructure accounts or automation hosts, consider adding narrow exceptions using a combination of IAM role, IP range, or user agent.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
- Identify the account role in the cloud environment.
- Assess the criticality of affected services and servers.
- Work with your IT team to identify and minimize the impact on users.
- Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
- Identify any regulatory or legal ramifications related to this activity.
- 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.
- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
- Consider enabling multi-factor authentication for users.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
- Take the actions needed to return affected systems, data, or services to their normal operational levels.
- Identify the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- 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).
- **Containment**
- If the deletion is unauthorized, review other CloudWatch resources for additional tampering (alarms, log groups, metric filters).
- Temporarily restrict permissions for the implicated IAM user or role.
## Setup
- **Investigation**
- Reconstruct any missing telemetry from alternative sources (e.g., S3 buckets, application logs, third-party logging systems).
- Review CloudTrail and Config timelines for preceding suspicious events.
- Validate whether the deleted log stream contained evidence of prior compromise.
The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
- **Recovery and hardening**
- Implement IAM least-privilege for `logs:DeleteLogStream`.
- Enable AWS Config rules to monitor CloudWatch Logs configuration changes.
- Ensure that business-critical log groups enforce minimum retention periods and prevent accidental deletion.
- Integrate log stream lifecycle management into CI/CD to avoid manual deletions.
- Establish guardrails using Service Control Policies (SCPs) to block log deletions outside designated automation roles.
### Additional information
- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
- **Security Best Practices:** [AWS Knowledge Center Security Best Practices](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/).
"""
references = [
"https://awscli.amazonaws.com/v2/documentation/api/latest/reference/logs/delete-log-stream.html",
"https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DeleteLogStream.html",
@@ -83,8 +121,9 @@ tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS CloudWatch",
"Data Source: Amazon CloudWatch",
"Use Case: Log Auditing",
"Tactic: Defense Evasion",
"Tactic: Impact",
"Resources: Investigation Guide",
]
@@ -92,7 +131,12 @@ timestamp_override = "event.ingested"
type = "query"
query = '''
event.dataset:aws.cloudtrail and event.provider:logs.amazonaws.com and event.action:DeleteLogStream and event.outcome:success
event.dataset: "aws.cloudtrail"
and event.provider: "logs.amazonaws.com"
and event.action: "DeleteLogStream"
and event.outcome: "success"
and source.ip: *
and not user_agent.original : "AWS Internal"
'''
@@ -126,3 +170,20 @@ id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.access_key_id",
"target.entity.id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
]