AWS VPC Flow Logs Deletion
Identifies the deletion of one or more flow logs in AWS Elastic Compute Cloud (EC2). An adversary may delete flow logs in an attempt to evade defenses.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/06/15"
3integration = ["aws"]
4maturity = "production"
5updated_date = "2024/05/21"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies the deletion of one or more flow logs in AWS Elastic Compute Cloud (EC2). An adversary may delete flow logs
11in an attempt to evade defenses.
12"""
13false_positives = [
14 """
15 Verify whether the user identity, user agent, and/or hostname should be making changes in your environment. Flow log
16 deletions by unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can
17 be exempted from the rule.
18 """,
19]
20from = "now-60m"
21index = ["filebeat-*", "logs-aws.cloudtrail-*"]
22interval = "10m"
23language = "kuery"
24license = "Elastic License v2"
25name = "AWS VPC Flow Logs Deletion"
26note = """## Triage and analysis
27
28### Investigating AWS VPC Flow Logs Deletion
29
30VPC Flow Logs is an AWS feature that enables you to capture information about the IP traffic going to and from network interfaces in your virtual private cloud (VPC). Flow log data can be published to Amazon CloudWatch Logs or Amazon S3.
31
32This rule identifies the deletion of VPC flow logs using the API `DeleteFlowLogs` action. Attackers can do this to cover their tracks and impact security monitoring that relies on this source.
33
34#### Possible investigation steps
35
36- Identify the user account that performed the action and whether it should perform this kind of action.
37- Investigate other alerts associated with the user account during the past 48 hours.
38- Contact the account and resource owners and confirm whether they are aware of this activity.
39- Check if this operation was approved and performed according to the organization's change management policy.
40- Considering the source IP address and geolocation of the user who issued the command:
41 - Do they look normal for the user?
42 - 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?
43 - 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?
44- 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.
45
46### False positive analysis
47
48- 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.
49- Administrators may rotate these logs after a certain period as part of their retention policy or after importing them to a SIEM.
50
51### Response and remediation
52
53- Initiate the incident response process based on the outcome of the triage.
54- Disable or limit the account during the investigation and response.
55- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
56 - Identify the account role in the cloud environment.
57 - Assess the criticality of affected services and servers.
58 - Work with your IT team to identify and minimize the impact on users.
59 - Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
60 - Identify any regulatory or legal ramifications related to this activity.
61- 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.
62- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
63- Consider enabling multi-factor authentication for users.
64- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
65- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
66- Take the actions needed to return affected systems, data, or services to their normal operational levels.
67- Identify the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
68- 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).
69
70## Setup
71
72The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
73references = [
74 "https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/delete-flow-logs.html",
75 "https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DeleteFlowLogs.html",
76]
77risk_score = 73
78rule_id = "9395fd2c-9947-4472-86ef-4aceb2f7e872"
79severity = "high"
80tags = [
81 "Domain: Cloud",
82 "Data Source: AWS",
83 "Data Source: Amazon Web Services",
84 "Use Case: Log Auditing",
85 "Resources: Investigation Guide",
86 "Tactic: Defense Evasion",
87]
88timestamp_override = "event.ingested"
89type = "query"
90
91query = '''
92event.dataset:aws.cloudtrail and event.provider:ec2.amazonaws.com and event.action:DeleteFlowLogs and event.outcome:success
93'''
94
95
96[[rule.threat]]
97framework = "MITRE ATT&CK"
98[[rule.threat.technique]]
99id = "T1562"
100name = "Impair Defenses"
101reference = "https://attack.mitre.org/techniques/T1562/"
102[[rule.threat.technique.subtechnique]]
103id = "T1562.001"
104name = "Disable or Modify Tools"
105reference = "https://attack.mitre.org/techniques/T1562/001/"
106
107
108
109[rule.threat.tactic]
110id = "TA0005"
111name = "Defense Evasion"
112reference = "https://attack.mitre.org/tactics/TA0005/"
Triage and analysis
Investigating AWS VPC Flow Logs Deletion
VPC Flow Logs is an AWS feature that enables you to capture information about the IP traffic going to and from network interfaces in your virtual private cloud (VPC). Flow log data can be published to Amazon CloudWatch Logs or Amazon S3.
This rule identifies the deletion of VPC flow logs using the API DeleteFlowLogs
action. Attackers can do this to cover their tracks and impact security monitoring that relies on this source.
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?
- 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.
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.
- Administrators may rotate these logs after a certain period as part of their retention policy or after importing them to a SIEM.
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 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).
Setup
The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
References
Related rules
- AWS CloudTrail Log Deleted
- AWS CloudTrail Log Suspended
- Route53 Resolver Query Log Configuration Deleted
- AWS CloudTrail Log Updated
- AWS CloudWatch Alarm Deletion