Skip to content

Commit 5c1ee12

Browse files
authored
[Rule Tuning] AWS GetSessionToken Abuse (#5274)
This rule is extremely loud in telemetry with no meaningful way to reduce false positives. The behavior it's capturing is common behavior, however can be used for threat hunting, investigation and further correlation with other detection rules. I'm moving this to a BBR rule with a few changes: - removed IAMUser specification in the query. Temporary sessions can be created by both IAM Users and the Root Account. This rule should capture both instances. - reduced execution window - name change to AWS GetSessionToken Usage as this captured behavior is not indicative of abuse - added highlighted fields - updated description, FP and IG
1 parent 94bb664 commit 5c1ee12

File tree

2 files changed

+139
-113
lines changed

2 files changed

+139
-113
lines changed

rules/integrations/aws/privilege_escalation_sts_getsessiontoken_abuse.toml

Lines changed: 0 additions & 113 deletions
This file was deleted.
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
[metadata]
2+
bypass_bbr_timing = true
3+
creation_date = "2021/05/17"
4+
integration = ["aws"]
5+
maturity = "production"
6+
updated_date = "2025/11/03"
7+
8+
[rule]
9+
author = ["Austin Songer", "Elastic"]
10+
building_block_type = "default"
11+
description = """
12+
Identifies the use of GetSessionToken API calls by IAM users or Root Account. While this is a common and legitimate
13+
operation used to obtain temporary credentials, it also provides adversaries with a method to generate short-lived
14+
tokens for stealthy activity. Attackers who compromise IAM user access keys may call GetSessionToken to create temporary
15+
credentials, which they can then use to move laterally, escalate privileges, or persist after key rotation. This rule is
16+
intended as a BBR to establish patterns of typical STS usage and support correlation with higher-fidelity detections.
17+
"""
18+
false_positives = [
19+
"""
20+
GetSessionToken is widely used by legitimate automation, CLI users, and administrative scripts to acquire temporary
21+
credentials. Frequent, authorized usage is expected in most environments, especially where IAM users authenticate
22+
with MFA or use short-lived tokens. Review IAM and CI/CD users, SDKs, and service accounts that regularly perform
23+
this action and document them in an allowlist. Suppress or tune accordingly to reduce noise.
24+
""",
25+
]
26+
from = "now-6m"
27+
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
28+
language = "kuery"
29+
license = "Elastic License v2"
30+
name = "AWS STS GetSessionToken Usage"
31+
note = """## Triage and analysis
32+
33+
> **Disclaimer**:
34+
> 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.
35+
36+
### Investigating AWS STS GetSessionToken Usage
37+
38+
AWS Security Token Service (STS) provides temporary credentials for AWS resources, crucial for managing access without long-term credentials. Adversaries may exploit `GetSessionToken` to create temporary credentials, enabling lateral movement and privilege escalation. The detection rule identifies successful `GetSessionToken` requests, flagging potential misuse for further investigation.
39+
40+
#### Possible investigation steps
41+
- **Establish normal baseline behavior**
42+
- Use this rule’s data to determine which IAM users or automation scripts routinely perform `GetSessionToken`.
43+
- Monitor frequency, regions, and user agents (CLI, SDK, console) for each identity over time.
44+
45+
- **Identify anomalies**
46+
- Look for first-time or rare `GetSessionToken` usage by an IAM user.
47+
- Detect tokens issued without MFA when MFA is normally required.
48+
- Identify new or unexpected source IPs, geographies, or user agents (e.g., API calls from unfamiliar networks).
49+
- Check for multiple temporary tokens minted in rapid succession by the same user or access key.
50+
51+
- **Correlate with downstream activity**
52+
- Search for immediate follow-on events within 15 minutes of token creation:
53+
- `AssumeRole` into higher-privileged roles or cross-account roles.
54+
- Privileged API calls (e.g., `iam:*`, `s3:PutBucketPolicy`, `ec2:CreateSnapshot`).
55+
- New region access, resource enumeration, or credential operations (`GetCallerIdentity`, `ListUsers`, etc.).
56+
- Use this correlation to elevate contextual `GetSessionToken` behavior into actionable detections.
57+
58+
### Usage Notes
59+
- This rule’s telemetry can support hunting queries such as:
60+
- `GetSessionToken` without `TokenCode` (no MFA)
61+
- New IP + `GetSessionToken` + `AssumeRole`
62+
- Rapid token issuance followed by API activity from a new ASN
63+
64+
Use these patterns in combination with related BBRs or detection rules for `AssumeRole` abuse, cross-account access,
65+
or credential pivoting for more reliable threat detection.
66+
"""
67+
references = ["https://docs.aws.amazon.com/STS/latest/APIReference/API_GetSessionToken.html"]
68+
risk_score = 21
69+
rule_id = "b45ab1d2-712f-4f01-a751-df3826969807"
70+
severity = "low"
71+
tags = [
72+
"Domain: Cloud",
73+
"Data Source: AWS",
74+
"Data Source: Amazon Web Services",
75+
"Data Source: AWS STS",
76+
"Use Case: Identity and Access Audit",
77+
"Tactic: Privilege Escalation",
78+
"Tactic: Lateral Movement",
79+
"Resources: Investigation Guide",
80+
"Rule Type: BBR",
81+
]
82+
timestamp_override = "event.ingested"
83+
type = "query"
84+
85+
query = '''
86+
event.dataset: aws.cloudtrail
87+
and event.provider: sts.amazonaws.com
88+
and event.action: GetSessionToken
89+
and event.outcome: success
90+
'''
91+
92+
93+
[[rule.threat]]
94+
framework = "MITRE ATT&CK"
95+
[[rule.threat.technique]]
96+
id = "T1548"
97+
name = "Abuse Elevation Control Mechanism"
98+
reference = "https://attack.mitre.org/techniques/T1548/"
99+
100+
101+
[rule.threat.tactic]
102+
id = "TA0004"
103+
name = "Privilege Escalation"
104+
reference = "https://attack.mitre.org/tactics/TA0004/"
105+
[[rule.threat]]
106+
framework = "MITRE ATT&CK"
107+
[[rule.threat.technique]]
108+
id = "T1550"
109+
name = "Use Alternate Authentication Material"
110+
reference = "https://attack.mitre.org/techniques/T1550/"
111+
[[rule.threat.technique.subtechnique]]
112+
id = "T1550.001"
113+
name = "Application Access Token"
114+
reference = "https://attack.mitre.org/techniques/T1550/001/"
115+
116+
117+
118+
[rule.threat.tactic]
119+
id = "TA0008"
120+
name = "Lateral Movement"
121+
reference = "https://attack.mitre.org/tactics/TA0008/"
122+
123+
[rule.investigation_fields]
124+
field_names = [
125+
"@timestamp",
126+
"user.name",
127+
"user_agent.original",
128+
"source.ip",
129+
"aws.cloudtrail.user_identity.arn",
130+
"aws.cloudtrail.user_identity.type",
131+
"aws.cloudtrail.user_identity.access_key_id",
132+
"event.action",
133+
"event.outcome",
134+
"cloud.account.id",
135+
"cloud.region",
136+
"aws.cloudtrail.request_parameters",
137+
"aws.cloudtrail.response_elements",
138+
]
139+

0 commit comments

Comments
 (0)