Skip to content

Commit 6a019fb

Browse files
authored
Merge branch 'main' into cs_paths
2 parents 82ebfa3 + dd918b1 commit 6a019fb

13 files changed

+669
-294
lines changed

detection_rules/etc/non-ecs-schema.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"TargetLogonId": "keyword",
4444
"TargetProcessGUID": "keyword",
4545
"TargetSid": "keyword",
46-
"SchemaFriendlyName": "keyword",
46+
"SchemaFriendlyName": "keyword",
4747
"Resource": "keyword",
4848
"RpcCallClientLocality": "keyword",
4949
"PrivilegeList": "keyword",
@@ -207,5 +207,17 @@
207207
"logs-okta*": {
208208
"okta.debug_context.debug_data.flattened.requestedScopes": "keyword",
209209
"okta.debug_context.debug_data.flattened.grantType": "keyword"
210+
},
211+
"logs-network_traffic.http*": {
212+
"data_stream.dataset": "keyword",
213+
"url.path": "keyword",
214+
"http.request.referrer": "keyword",
215+
"http.request.headers.content-type": "keyword",
216+
"network.direction": "keyword",
217+
"http.request.method": "keyword",
218+
"request": "keyword",
219+
"http.request.body.bytes": "long",
220+
"http.request.body.content": "keyword",
221+
"http.response.headers.server": "keyword"
210222
}
211223
}

rules/integrations/aws/defense_evasion_sts_get_federation_token.toml

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,62 @@
22
creation_date = "2024/08/19"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/08/25"
66

77
[rule]
88
author = ["Elastic"]
99
description = """
10-
Identifies the first occurrence of an AWS Security Token Service (STS) `GetFederationToken` request made by a user
11-
within the last 10 days. The `GetFederationToken` API call allows users to request temporary security credentials to
12-
access AWS resources. Adversaries may use this API to obtain temporary credentials to access resources they would not
13-
normally have access to.
10+
Identifies the first occurrence of an AWS Security Token Service (STS) GetFederationToken request made by a user. The GetFederationToken API call allows users to request temporary security credentials to
11+
access AWS resources. The maximum expiration period for these tokens is 36 hours and they can be used to create a console signin token even for identities that don't already have one. Adversaries may use this API to obtain temporary credentials for persistence and to bypass IAM API call limitations by gaining console access.
1412
"""
15-
from = "now-9m"
13+
from = "now-6m"
1614
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
1715
language = "kuery"
1816
license = "Elastic License v2"
19-
name = "First Occurrence of STS GetFederationToken Request by User"
17+
name = "AWS First Occurrence of STS GetFederationToken Request by User"
2018
references = [
21-
"https://hackingthe.cloud/aws/post_exploitation/survive_access_key_deletion_with_sts_getfederationtoken/"
19+
"https://hackingthe.cloud/aws/post_exploitation/survive_access_key_deletion_with_sts_getfederationtoken/",
20+
"https://www.crowdstrike.com/en-us/blog/how-adversaries-persist-with-aws-user-federation/",
21+
"https://medium.com/@adan.alvarez/how-attackers-persist-in-aws-using-getfederationtoken-a-simple-and-effective-technique-used-in-the-987ec1f0bdfe/"
2222
]
23-
risk_score = 21
23+
risk_score = 47
2424
rule_id = "7a5cc9a8-5ea3-11ef-beec-f661ea17fbce"
25-
severity = "low"
25+
severity = "medium"
2626
tags = [
2727
"Domain: Cloud",
2828
"Data Source: Amazon Web Services",
2929
"Data Source: AWS",
3030
"Data Source: AWS STS",
3131
"Use Case: Threat Detection",
3232
"Tactic: Defense Evasion",
33+
"Tactic: Persistence",
3334
"Resources: Investigation Guide",
3435
]
3536
timestamp_override = "event.ingested"
3637
type = "new_terms"
3738

3839
query = '''
3940
event.dataset: "aws.cloudtrail"
40-
and event.provider: sts.amazonaws.com
41-
and event.action: GetFederationToken
41+
and event.provider:sts.amazonaws.com
42+
and event.action:GetFederationToken
43+
and event.outcome:success
4244
'''
4345
note = """## Triage and analysis
4446
4547
> **Disclaimer**:
4648
> 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.
4749
48-
### Investigating First Occurrence of STS GetFederationToken Request by User
50+
### Investigating AWS First Occurrence of STS GetFederationToken Request by User
4951
50-
AWS Security Token Service (STS) enables users to request temporary credentials for accessing AWS resources. While beneficial for legitimate use, adversaries may exploit this to gain unauthorized access. The detection rule identifies unusual activity by flagging the first instance of a `GetFederationToken` request by a user within a 10-day window, helping to uncover potential misuse aimed at evading defenses.
52+
AWS Security Token Service (STS) enables users to request temporary credentials for accessing AWS resources. While beneficial for legitimate use, adversaries may exploit this to gain unauthorized access. These credentials will remain active for the duration specified (maximum 36 hours), even if the initial compromised identity is deleted. They can also be used to request a console signin token which allows the adversary to make sensitive IAM API calls which would otherwise be denied with the federation token alone. The detection rule identifies unusual activity by flagging the first instance of a `GetFederationToken` request by a user helping to uncover potential misuse aimed at evading defenses and gaining persistence.
5153
5254
### Possible investigation steps
5355
54-
- Review the specific user account associated with the GetFederationToken request to determine if the activity aligns with their typical behavior and role within the organization.
55-
- Examine the AWS CloudTrail logs for additional context around the time of the GetFederationToken request, looking for any other unusual or suspicious activities by the same user or related accounts.
56-
- Check the source IP address and geolocation of the GetFederationToken request to identify if it originates from an expected or unexpected location.
57-
- Investigate the resources accessed using the temporary credentials obtained from the GetFederationToken request to assess if there was any unauthorized or suspicious access.
58-
- Consult with the user or their manager to verify if the GetFederationToken request was legitimate and necessary for their work tasks.
56+
- Review the specific user account associated with the `GetFederationToken` request to determine if the activity aligns with their typical behavior and role within the organization.
57+
- Examine the AWS CloudTrail logs for additional context around the time of the `GetFederationToken` request, looking for any other unusual or suspicious activities by the same user or related accounts.
58+
- Check the `source.ip` and `source.geo` fields of the request to identify if it originates from an expected or unexpected location.
59+
- View the `aws.cloudtrail.response_elements` to find the created `federatedUser.arn`. Investigate the resources accessed by this Federated User to assess if there was any suspicious activity.
60+
- Consult with the requesting user `aws.cloudtrail.user_identity.arn` to verify if the `GetFederationToken` request was legitimate and necessary for their work tasks.
5961
6062
### False positive analysis
6163
@@ -66,14 +68,29 @@ AWS Security Token Service (STS) enables users to request temporary credentials
6668
6769
### Response and remediation
6870
69-
- Immediately revoke the temporary credentials associated with the `GetFederationToken` request to prevent unauthorized access to AWS resources.
70-
- Review CloudTrail logs to identify any suspicious activities performed using the temporary credentials and assess the potential impact on AWS resources.
71-
- Isolate the affected user account by disabling it temporarily to prevent further unauthorized actions until a thorough investigation is completed.
71+
- If compromise is verified, attach a policy that denies all actions, effectively preventing any further activity, even from temporary credentials. You can use the AWS-managed policy [AWSDenyAll](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSDenyAll.html). This ensures that any temporary credentials generated by the compromised user are also blocked, stopping the attacker’s activities.
7272
- Notify the security team and relevant stakeholders about the incident for awareness and further investigation.
7373
- Conduct a root cause analysis to determine how the `GetFederationToken` request was initiated and identify any potential security gaps or misconfigurations.
7474
- Implement additional monitoring and alerting for `GetFederationToken` requests to detect and respond to similar activities promptly in the future.
7575
- Review and update IAM policies and permissions to ensure that only authorized users have the ability to request temporary credentials, reducing the risk of misuse."""
7676

77+
[rule.investigation_fields]
78+
field_names = [
79+
"@timestamp",
80+
"user.name",
81+
"user_agent.original",
82+
"source.ip",
83+
"aws.cloudtrail.user_identity.arn",
84+
"aws.cloudtrail.user_identity.type",
85+
"aws.cloudtrail.user_identity.access_key_id",
86+
"event.action",
87+
"event.outcome",
88+
"cloud.account.id",
89+
"cloud.region",
90+
"aws.cloudtrail.request_parameters",
91+
"aws.cloudtrail.response_elements"
92+
]
93+
7794
[[rule.threat]]
7895
framework = "MITRE ATT&CK"
7996
[[rule.threat.technique]]
@@ -90,6 +107,22 @@ reference = "https://attack.mitre.org/techniques/T1550/001/"
90107
id = "TA0005"
91108
name = "Defense Evasion"
92109
reference = "https://attack.mitre.org/tactics/TA0005/"
110+
[[rule.threat]]
111+
framework = "MITRE ATT&CK"
112+
[[rule.threat.technique]]
113+
id = "T1098"
114+
name = "Account Manipulation"
115+
reference = "https://attack.mitre.org/techniques/T1098/"
116+
[[rule.threat.technique.subtechnique]]
117+
id = "T1098.001"
118+
name = "Additional Cloud Credentials"
119+
reference = "https://attack.mitre.org/techniques/T1098/001/"
120+
121+
122+
[rule.threat.tactic]
123+
id = "TA0003"
124+
name = "Persistence"
125+
reference = "https://attack.mitre.org/tactics/TA0003/"
93126

94127
[rule.new_terms]
95128
field = "new_terms_fields"

rules/integrations/aws/execution_new_terms_cloudformation_createstack.toml

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
[metadata]
2-
creation_date = "2020/07/25"
2+
creation_date = "2024/07/25"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/08/27"
66

77
[rule]
88
author = ["Elastic"]
99
description = """
10-
This rule detects the first time a principal calls AWS Cloudwatch `CreateStack` or `CreateStackSet` API. Cloudformation
11-
is used to create a single collection of cloud resources called a stack, via a defined template file. An attacker with
12-
the appropriate privileges could leverage Cloudformation to create specific resources needed to further exploit the
13-
environment. This is a new terms rule that looks for the first instance of this behavior in the last 10 days for a role
14-
or IAM user within a particular account.
10+
This rule detects the first time a principal calls AWS CloudFormation CreateStack, CreateStackSet or CreateStackInstances API. CloudFormation is used to create a collection of cloud resources called a stack, via a defined template file. An attacker with the appropriate privileges could leverage CloudFormation to create specific resources needed to further exploit the environment. This is a new terms rule that looks for the first instance of this behavior for a role or IAM user within a particular account.
1511
"""
1612
false_positives = [
1713
"""
18-
Verify whether the user identity should be using the `CreateStack` or `CreateStackSet` APIs. If known behavior is
14+
Verify whether the user identity should be using the triggered API. If known behavior is
1915
causing false positives, it can be exempted from the rule. The "history_window_start" value can be modified to
2016
reflect the expected frequency of known activity within a particular environment.
2117
""",
@@ -24,12 +20,10 @@ from = "now-6m"
2420
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
2521
language = "kuery"
2622
license = "Elastic License v2"
27-
name = "First Time AWS Cloudformation Stack Creation by User"
23+
name = "First Time AWS CloudFormation Stack Creation"
2824
references = [
29-
"https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-cli-creating-stack.html/",
30-
"https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html/",
31-
"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html/",
32-
"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStackSet.html/",
25+
"https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html",
26+
"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html",
3327
]
3428
risk_score = 47
3529
rule_id = "0415258b-a7b2-48a6-891a-3367cd9d4d31"
@@ -38,7 +32,7 @@ tags = [
3832
"Domain: Cloud",
3933
"Data Source: AWS",
4034
"Data Source: Amazon Web Services",
41-
"Data Source: Cloudformation",
35+
"Data Source: CloudFormation",
4236
"Use Case: Asset Visibility",
4337
"Tactic: Execution",
4438
"Resources: Investigation Guide",
@@ -48,23 +42,24 @@ type = "new_terms"
4842

4943
query = '''
5044
event.dataset:aws.cloudtrail and event.provider:cloudformation.amazonaws.com and
51-
event.action: (CreateStack or CreateStackSet) and event.outcome:success
45+
event.action: (CreateStack or CreateStackInstances)
46+
and event.outcome:success
5247
'''
5348
note = """## Triage and analysis
5449
5550
> **Disclaimer**:
5651
> 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.
5752
58-
### Investigating First Time AWS Cloudformation Stack Creation by User
53+
### Investigating First Time AWS CloudFormation Stack Creation
5954
60-
AWS CloudFormation automates the setup of cloud resources using templates, streamlining infrastructure management. Adversaries with access can exploit this to deploy malicious resources, escalating their control. The detection rule identifies unusual activity by flagging the initial use of stack creation APIs by a user, helping to spot potential unauthorized actions early.
55+
AWS CloudFormation automates the setup of cloud resources using templates, streamlining infrastructure management. Adversaries with access can exploit this to deploy malicious resources, escalating their control. The detection rule identifies unusual activity by flagging the initial use of stack creation APIs by a user or role, helping to spot potential unauthorized actions early.
6156
6257
### Possible investigation steps
6358
64-
- Review the CloudTrail logs for the specific event.dataset:aws.cloudtrail and event.provider:cloudformation.amazonaws.com to identify the user or role that initiated the CreateStack or CreateStackSet action.
59+
- Review `aws.cloudtrail.user_identity.arn` to identify the user or role that initiated the `CreateStack` or `CreateStackInstances` action.
6560
- Verify the IAM permissions of the user or role involved in the event to ensure they have the appropriate level of access and determine if the action aligns with their typical responsibilities.
66-
- Examine the stack template used in the CreateStack or CreateStackSet action to identify any unusual or unauthorized resources being provisioned.
67-
- Check the event.outcome:success field to confirm the stack creation was successful and investigate any related resources that were deployed as part of the stack.
61+
- Examine the stack template used to identify any unusual or unauthorized resources being provisioned.
62+
- Investigate any related resources that were deployed as part of the stack.
6863
- Correlate the timing of the stack creation with other logs or alerts to identify any suspicious activity or patterns that might indicate malicious intent.
6964
- Investigate the account's recent activity history to determine if there have been any other first-time or unusual actions by the same user or role.
7065
@@ -78,18 +73,37 @@ AWS CloudFormation automates the setup of cloud resources using templates, strea
7873
7974
### Response and remediation
8075
81-
- Immediately isolate the IAM user or role that initiated the stack creation to prevent further unauthorized actions. This can be done by revoking permissions or disabling the account temporarily.
82-
- Review the created stack and stack set for any unauthorized or suspicious resources. Identify and terminate any resources that are not part of the expected infrastructure.
76+
- Immediately isolate the IAM user or role that initiated the stack creation to prevent further unauthorized actions. This can be done by revoking permissions with a [DenyAll](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSDenyAll.html) permissions policy or disabling the account temporarily.
77+
- Review the created stack for any unauthorized or suspicious resources. Identify and terminate any resources that are not part of the expected infrastructure.
8378
- Conduct a thorough audit of recent IAM activity to identify any other unusual or unauthorized actions that may indicate further compromise.
8479
- If malicious activity is confirmed, escalate the incident to the security operations team for a full investigation and potential involvement of incident response teams.
8580
- Implement additional monitoring and alerting for the affected account to detect any further unauthorized attempts to use CloudFormation or other critical AWS services.
86-
- Review and tighten IAM policies and permissions to ensure that only necessary privileges are granted, reducing the risk of exploitation by adversaries.
87-
- Consider enabling AWS CloudTrail logging and AWS Config rules to maintain a detailed record of all API activity and configuration changes for ongoing monitoring and compliance."""
88-
81+
- Review and tighten IAM policies and permissions to ensure that only necessary privileges are granted, reducing the risk of exploitation by adversaries."""
82+
83+
[rule.investigation_fields]
84+
field_names = [
85+
"@timestamp",
86+
"user.name",
87+
"user_agent.original",
88+
"source.ip",
89+
"aws.cloudtrail.user_identity.arn",
90+
"aws.cloudtrail.user_identity.type",
91+
"aws.cloudtrail.user_identity.access_key_id",
92+
"event.action",
93+
"event.outcome",
94+
"cloud.account.id",
95+
"cloud.region",
96+
"aws.cloudtrail.request_parameters",
97+
"aws.cloudtrail.response_elements"
98+
]
8999

90100
[[rule.threat]]
91101
framework = "MITRE ATT&CK"
92102

103+
[[rule.threat.technique]]
104+
id = "T1648"
105+
name = "Serverless Execution"
106+
reference = "https://attack.mitre.org/techniques/T1648/"
93107
[rule.threat.tactic]
94108
id = "TA0002"
95109
name = "Execution"

0 commit comments

Comments
 (0)