Skip to content

Commit 76e083c

Browse files
authored
[Rule Tunings] AWS Route Table Created / AWS EC2 Route Table Modified or Deleted (#5064)
* [Rule Tunings] AWS Route Table Created / AWS EC2 Route Table Modified or Deleted AWS Route Table Created - turned this into a new_terms rule to reduce noise and be more indicative of potential malicious behavior. Used `cloud.account.id`, `user.name` combination to account for both roles and users doing this behavior for the first time. - changed execution interval - changed the name to add EC2 - slight adjustments to IG and description - fixed tagging error - added investigation fields AWS EC2 Route Table Modified or Deleted - replaced new terms field to `cloud.account.id`, `user.name` combination to account for both roles and users doing this behavior for the first time. - removed the exclusions from this rule. These exclusions, while meant to reduce noise caused by automation tools, actually just provide an easy bypass. A user can simply use CloudFormation to perform the exact same behaviors and avoid detection. I've shown this in the screenshot below, I ran a nearly identical script, one with and one without using CloudFormation. While `source.address` is `cloudformation.amazonaws.com` the behavior was still performed by an IAMUser and should still be evaluated. The fact that this is a new terms rule will reduce the risk of noise due to automation using these tools. - changed execution interval - slight adjustments to IG and description - added investigation fields * Update persistence_route_table_created.toml * Update rules/integrations/aws/persistence_ec2_route_table_modified_or_deleted.toml
1 parent e22f60f commit 76e083c

File tree

2 files changed

+66
-31
lines changed

2 files changed

+66
-31
lines changed

rules/integrations/aws/persistence_ec2_route_table_modified_or_deleted.toml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,23 @@
22
creation_date = "2021/06/05"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/02/03"
5+
updated_date = "2025/09/04"
66

77
[rule]
88
author = ["Elastic", "Austin Songer"]
99
description = """
1010
Identifies AWS CloudTrail events where an EC2 route table or association has been modified or deleted. Route table or
11-
association modifications can be used by attackers to disrupt network traffic, reroute communications, or maintain
12-
persistence in a compromised environment. This is a [New
13-
Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that detects the
14-
first instance of this behavior by the `aws.cloudtrail.user_identity.arn` field in the last 10 days.
11+
association modifications can be used by attackers to disrupt network traffic, reroute communications, or maintain persistence in a compromised environment. This is a New Terms rule that detects the first instance of this behavior by a user or role.
1512
"""
1613
false_positives = [
1714
"""
18-
Route Table could be modified or deleted by a system administrator. Verify whether the user identity, user agent,
19-
and/or hostname should be making changes in your environment. Route Table being modified from unfamiliar users
15+
Route Tables could be modified or deleted by a system administrator. Verify whether the user identity, user agent,
16+
and/or hostname should be making changes in your environment. Route Tables being modified from unfamiliar users
2017
should be investigated. If known behavior is causing false positives, it can be exempted from the rule. Also
2118
automated processes that use Terraform may lead to false positives.
2219
""",
2320
]
24-
from = "now-9m"
21+
from = "now-6m"
2522
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
2623
language = "kuery"
2724
license = "Elastic License v2"
@@ -36,7 +33,7 @@ This rule detects modifications or deletions of AWS route tables using actions s
3633
#### Possible Investigation Steps
3734
3835
- **Review Request Parameters:**
39-
- Check the `aws.cloudtrail.flattened.request_parameters` field. The sub-fields may vary depending on the `event.action` (e.g., `routeTableId` for `DeleteRouteTable`, `destinationCidrBlock` for `ReplaceRoute`).
36+
- Check the `aws.cloudtrail.request_parameters` field. The sub-fields may vary depending on the `event.action` (e.g., `routeTableId` for `DeleteRouteTable`, `destinationCidrBlock` for `ReplaceRoute`).
4037
- Validate the affected route table, routes, or associations based on the API call:
4138
- For `ReplaceRoute`: Look for changes in specific routes using `destinationCidrBlock`.
4239
- For `ReplaceRouteTableAssociation`: Review the new association details (e.g., subnet ID).
@@ -50,7 +47,7 @@ This rule detects modifications or deletions of AWS route tables using actions s
5047
5148
- **Analyze Request Details**:
5249
- **Action Type**: Verify the specific API call in the `event.action` field (e.g., `ReplaceRoute`, `DeleteRouteTable`) to understand the nature of the modification.
53-
- **Source IP and Geolocation**: Examine the `source.address` and `source.geo` fields to confirm whether the request originated from a trusted location. Suspicious geolocations or IPs may indicate adversarial activity.
50+
- **Source IP and Geolocation**: Examine the `source.ip` and `source.geo` fields to confirm whether the request originated from a trusted location. Suspicious geolocations or IPs may indicate adversarial activity.
5451
- **User Agent**: Review the `user_agent.original` field to determine the tool used for the request (e.g., AWS CLI, Terraform). Unusual or custom user agents may indicate malicious intent.
5552
5653
- **Correlate with Other Activity**:
@@ -70,7 +67,7 @@ This rule detects modifications or deletions of AWS route tables using actions s
7067
7168
### Response and Remediation
7269
73-
- **Revoke Unauthorized Permissions**: If unauthorized, remove permissions for `ec2:ReplaceRoute`, `ec2:DeleteRouteTable`, or other related actions from the user or role.
70+
- **Revoke Unauthorized Permissions**: If unauthorized, remove permissions for related actions from the user or role. You can use the managed [AWSDenyAll](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSDenyAll.html) policy.
7471
- **Restore the Route Table**:
7572
- If critical networking was impacted, restore the route table or reapply previous configurations from backups or Terraform state files.
7673
- Verify connectivity to affected subnets or instances to ensure no disruptions to services.
@@ -117,13 +114,24 @@ event.dataset: "aws.cloudtrail"
117114
"DisassociateRouteTable"
118115
)
119116
and event.outcome: "success"
120-
and not source.address: (
121-
"cloudformation.amazonaws.com" or
122-
"servicecatalog.amazonaws.com" or
123-
"fsx.amazonaws.com"
124-
)
125117
'''
126118

119+
[rule.investigation_fields]
120+
field_names = [
121+
"@timestamp",
122+
"user.name",
123+
"user_agent.original",
124+
"source.ip",
125+
"aws.cloudtrail.user_identity.arn",
126+
"aws.cloudtrail.user_identity.type",
127+
"aws.cloudtrail.user_identity.access_key_id",
128+
"event.action",
129+
"event.outcome",
130+
"cloud.account.id",
131+
"cloud.region",
132+
"aws.cloudtrail.request_parameters",
133+
"aws.cloudtrail.response_elements"
134+
]
127135

128136
[[rule.threat]]
129137
framework = "MITRE ATT&CK"
@@ -135,7 +143,7 @@ reference = "https://attack.mitre.org/tactics/TA0003/"
135143

136144
[rule.new_terms]
137145
field = "new_terms_fields"
138-
value = ["aws.cloudtrail.user_identity.arn"]
146+
value = ["cloud.account.id", "user.name"]
139147
[[rule.new_terms.history_window_start]]
140148
field = "history_window_start"
141149
value = "now-10d"

rules/integrations/aws/persistence_route_table_created.toml

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
creation_date = "2021/06/05"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/09/04"
66

77
[rule]
88
author = ["Elastic", "Austin Songer"]
9-
description = "Identifies when an AWS Route Table has been created."
9+
description = """
10+
Identifies when an EC2 Route Table has been created. Route tables can be used by attackers to disrupt network traffic, reroute communications, or maintain persistence in a compromised environment. This is a New Terms rule that detects the first instance of this behavior by a user or role.
11+
"""
1012
false_positives = [
1113
"""
1214
Route Tables may be created by a system or network administrators. Verify whether the user identity, user agent,
@@ -15,26 +17,23 @@ false_positives = [
1517
processes that use Terraform may lead to false positives.
1618
""",
1719
]
18-
from = "now-60m"
20+
from = "now-6m"
1921
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
20-
interval = "10m"
2122
language = "kuery"
2223
license = "Elastic License v2"
23-
name = "AWS Route Table Created"
24+
name = "AWS EC2 Route Table Created"
2425
note = """## Triage and analysis
2526
2627
> **Disclaimer**:
2728
> 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.
2829
29-
### Investigating AWS Route Table Created
30+
### Investigating AWS EC2 Route Table Created
3031
3132
AWS Route Tables are crucial components in managing network traffic within AWS environments, directing data between subnets and internet gateways. Adversaries may exploit route tables to reroute traffic for data exfiltration or to establish persistence by creating unauthorized routes. The detection rule monitors successful creation events of route tables, flagging potential misuse by correlating specific AWS CloudTrail logs, thus aiding in identifying unauthorized network configuration changes.
3233
3334
### Possible investigation steps
3435
35-
- Review the AWS CloudTrail logs for the specific event.provider:ec2.amazonaws.com and event.action values (CreateRoute or CreateRouteTable) to identify the user or role that initiated the route table creation.
36-
- Check the event.outcome:success field to confirm the successful creation of the route table and gather additional context such as timestamps and source IP addresses.
37-
- Investigate the associated AWS account and IAM user or role to determine if the action aligns with expected behavior and permissions.
36+
- Investigate the AWS account and IAM user or role to determine if the action aligns with expected behavior and permissions.
3837
- Examine the newly created route table's configuration to identify any unauthorized or suspicious routes that could indicate potential misuse or data exfiltration attempts.
3938
- Correlate the event with other network security monitoring data to identify any unusual traffic patterns or anomalies that coincide with the route table creation.
4039
- Assess the environment for any recent changes or incidents that might explain the creation of the route table, such as new deployments or infrastructure modifications.
@@ -49,7 +48,7 @@ AWS Route Tables are crucial components in managing network traffic within AWS e
4948
5049
### Response and remediation
5150
52-
- Immediately isolate the affected AWS account or VPC to prevent further unauthorized network changes and potential data exfiltration.
51+
- If unauthorized, remove permissions for related actions from the user or role. You can use the managed [AWSDenyAll](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSDenyAll.html) policy.
5352
- Review the newly created route table and any associated routes to identify unauthorized entries. Remove any routes that are not part of the expected network configuration.
5453
- Conduct a thorough audit of IAM roles and permissions to ensure that only authorized users have the ability to create or modify route tables. Revoke any excessive permissions identified.
5554
- Implement network monitoring to detect unusual traffic patterns that may indicate data exfiltration or other malicious activities.
@@ -72,19 +71,40 @@ tags = [
7271
"Domain: Cloud",
7372
"Data Source: AWS",
7473
"Data Source: Amazon Web Services",
75-
"Data Source: AWS Route53",
74+
"Data Source: AWS EC2",
7675
"Use Case: Network Security Monitoring",
7776
"Tactic: Persistence",
7877
"Resources: Investigation Guide",
7978
]
8079
timestamp_override = "event.ingested"
81-
type = "query"
80+
type = "new_terms"
8281

8382
query = '''
84-
event.dataset:aws.cloudtrail and event.provider:ec2.amazonaws.com and event.action:(CreateRoute or CreateRouteTable) and
85-
event.outcome:success
83+
event.dataset: "aws.cloudtrail"
84+
and event.provider: "ec2.amazonaws.com"
85+
and event.action:(
86+
"CreateRoute" or
87+
"CreateRouteTable"
88+
)
89+
and event.outcome: "success"
8690
'''
8791

92+
[rule.investigation_fields]
93+
field_names = [
94+
"@timestamp",
95+
"user.name",
96+
"user_agent.original",
97+
"source.ip",
98+
"aws.cloudtrail.user_identity.arn",
99+
"aws.cloudtrail.user_identity.type",
100+
"aws.cloudtrail.user_identity.access_key_id",
101+
"event.action",
102+
"event.outcome",
103+
"cloud.account.id",
104+
"cloud.region",
105+
"aws.cloudtrail.request_parameters",
106+
"aws.cloudtrail.response_elements"
107+
]
88108

89109
[[rule.threat]]
90110
framework = "MITRE ATT&CK"
@@ -94,3 +114,10 @@ id = "TA0003"
94114
name = "Persistence"
95115
reference = "https://attack.mitre.org/tactics/TA0003/"
96116

117+
[rule.new_terms]
118+
field = "new_terms_fields"
119+
value = ["cloud.account.id", "user.name"]
120+
[[rule.new_terms.history_window_start]]
121+
field = "history_window_start"
122+
value = "now-10d"
123+

0 commit comments

Comments
 (0)