AWS First Occurrence of STS GetFederationToken Request by User
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 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.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2024/08/19"
3integration = ["aws"]
4maturity = "production"
5updated_date = "2025/08/25"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies 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
11access 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.
12"""
13from = "now-6m"
14index = ["filebeat-*", "logs-aws.cloudtrail-*"]
15language = "kuery"
16license = "Elastic License v2"
17name = "AWS First Occurrence of STS GetFederationToken Request by User"
18references = [
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/"
22]
23risk_score = 47
24rule_id = "7a5cc9a8-5ea3-11ef-beec-f661ea17fbce"
25severity = "medium"
26tags = [
27 "Domain: Cloud",
28 "Data Source: Amazon Web Services",
29 "Data Source: AWS",
30 "Data Source: AWS STS",
31 "Use Case: Threat Detection",
32 "Tactic: Defense Evasion",
33 "Tactic: Persistence",
34 "Resources: Investigation Guide",
35]
36timestamp_override = "event.ingested"
37type = "new_terms"
38
39query = '''
40event.dataset: "aws.cloudtrail"
41 and event.provider:sts.amazonaws.com
42 and event.action:GetFederationToken
43 and event.outcome:success
44'''
45note = """## Triage and analysis
46
47> **Disclaimer**:
48> 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.
49
50### Investigating AWS First Occurrence of STS GetFederationToken Request by User
51
52AWS 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.
53
54### Possible investigation steps
55
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.
61
62### False positive analysis
63
64- Routine administrative tasks by cloud administrators may trigger the rule if they are using `GetFederationToken` for legitimate purposes. To manage this, create exceptions for known administrative accounts that regularly perform these actions.
65- Automated scripts or applications that use `GetFederationToken` for legitimate operations might be flagged. Identify these scripts and exclude their associated user accounts from the rule to prevent unnecessary alerts.
66- Third-party services integrated with AWS that require temporary credentials might cause false positives. Review and whitelist these services if they are verified and trusted to avoid repeated alerts.
67- New employees or contractors accessing AWS resources for the first time may trigger the rule. Implement a process to verify their access requirements and exclude their accounts if their actions are deemed non-threatening.
68
69### Response and remediation
70
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.
72- Notify the security team and relevant stakeholders about the incident for awareness and further investigation.
73- Conduct a root cause analysis to determine how the `GetFederationToken` request was initiated and identify any potential security gaps or misconfigurations.
74- Implement additional monitoring and alerting for `GetFederationToken` requests to detect and respond to similar activities promptly in the future.
75- 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."""
76
77[rule.investigation_fields]
78field_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
94[[rule.threat]]
95framework = "MITRE ATT&CK"
96[[rule.threat.technique]]
97id = "T1550"
98name = "Use Alternate Authentication Material"
99reference = "https://attack.mitre.org/techniques/T1550/"
100[[rule.threat.technique.subtechnique]]
101id = "T1550.001"
102name = "Application Access Token"
103reference = "https://attack.mitre.org/techniques/T1550/001/"
104
105
106[rule.threat.tactic]
107id = "TA0005"
108name = "Defense Evasion"
109reference = "https://attack.mitre.org/tactics/TA0005/"
110[[rule.threat]]
111framework = "MITRE ATT&CK"
112[[rule.threat.technique]]
113id = "T1098"
114name = "Account Manipulation"
115reference = "https://attack.mitre.org/techniques/T1098/"
116[[rule.threat.technique.subtechnique]]
117id = "T1098.001"
118name = "Additional Cloud Credentials"
119reference = "https://attack.mitre.org/techniques/T1098/001/"
120
121
122[rule.threat.tactic]
123id = "TA0003"
124name = "Persistence"
125reference = "https://attack.mitre.org/tactics/TA0003/"
126
127[rule.new_terms]
128field = "new_terms_fields"
129value = ["aws.cloudtrail.user_identity.arn"]
130[[rule.new_terms.history_window_start]]
131field = "history_window_start"
132value = "now-10d"
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, we recommend validating the content and adapting it to suit your specific environment and operational needs.
Investigating AWS First Occurrence of STS GetFederationToken Request by User
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.
Possible investigation steps
- 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. - 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. - Check the
source.ip
andsource.geo
fields of the request to identify if it originates from an expected or unexpected location. - View the
aws.cloudtrail.response_elements
to find the createdfederatedUser.arn
. Investigate the resources accessed by this Federated User to assess if there was any suspicious activity. - Consult with the requesting user
aws.cloudtrail.user_identity.arn
to verify if theGetFederationToken
request was legitimate and necessary for their work tasks.
False positive analysis
- Routine administrative tasks by cloud administrators may trigger the rule if they are using
GetFederationToken
for legitimate purposes. To manage this, create exceptions for known administrative accounts that regularly perform these actions. - Automated scripts or applications that use
GetFederationToken
for legitimate operations might be flagged. Identify these scripts and exclude their associated user accounts from the rule to prevent unnecessary alerts. - Third-party services integrated with AWS that require temporary credentials might cause false positives. Review and whitelist these services if they are verified and trusted to avoid repeated alerts.
- New employees or contractors accessing AWS resources for the first time may trigger the rule. Implement a process to verify their access requirements and exclude their accounts if their actions are deemed non-threatening.
Response and remediation
- 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. This ensures that any temporary credentials generated by the compromised user are also blocked, stopping the attacker’s activities.
- Notify the security team and relevant stakeholders about the incident for awareness and further investigation.
- Conduct a root cause analysis to determine how the
GetFederationToken
request was initiated and identify any potential security gaps or misconfigurations. - Implement additional monitoring and alerting for
GetFederationToken
requests to detect and respond to similar activities promptly in the future. - 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.
References
Related rules
- AWS STS Role Chaining
- AWS RDS DB Instance Made Public
- AWS RDS DB Instance or Cluster Password Modified
- AWS STS AssumeRole with New MFA Device
- AWS EC2 Security Group Configuration Change