Detection rules › Panther
AWS STS GetSessionToken by IAM User
Detects an IAM user calling STS GetSessionToken to obtain temporary credentials. Attackers who have compromised long-term IAM credentials may use GetSessionToken to generate short-lived session tokens for lateral movement or to bypass IP-based policies that apply only to long-term credentials.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation | T1548 Abuse Elevation Control Mechanism |
| Lateral Movement | T1550.001 Use Alternate Authentication Material: Application Access Token |
Rules detecting the same action
Other rules on this platform that filter on the same API call or operation.
Rule body yaml
AnalysisType: rule
Filename: aws_sts_getsessiontoken_misuse.py
RuleID: "AWS.STS.GetSessionToken.Misuse"
DisplayName: "AWS STS GetSessionToken by IAM User"
Enabled: true
LogTypes:
- AWS.CloudTrail
Tags:
- AWS
- AWS STS
- Lateral Movement:Use Alternate Authentication Material
- Privilege Escalation:Abuse Elevation Control Mechanism
Reports:
MITRE ATT&CK:
- TA0008:T1550.001
- TA0004:T1548
Status: Experimental
Severity: Low
Description: >
Detects an IAM user calling STS GetSessionToken to obtain temporary credentials.
Attackers who have compromised long-term IAM credentials may use GetSessionToken
to generate short-lived session tokens for lateral movement or to bypass IP-based
policies that apply only to long-term credentials.
Runbook: |
1. Query CloudTrail for all API calls by userIdentity:arn in the 6 hours before and after this alert to establish what the session token was used for
2. Check if sourceIPAddress is associated with known corporate network ranges, VPN endpoints, or cloud provider IP ranges
3. Find other alerts for this userIdentity:userName in the past 30 days to determine if GetSessionToken usage is part of normal workflow
Reference: https://docs.aws.amazon.com/STS/latest/APIReference/API_GetSessionToken.html
SummaryAttributes:
- userAgent
- sourceIpAddress
- recipientAccountId
- p_any_aws_arns
DedupPeriodMinutes: 60
Threshold: 1
Tests:
- Name: GetSessionToken by IAM User
ExpectedResult: true
Log:
{
"awsRegion": "us-east-1",
"eventID": "abc-123",
"eventName": "GetSessionToken",
"eventSource": "sts.amazonaws.com",
"eventTime": "2024-01-15T10:30:00Z",
"eventType": "AwsApiCall",
"eventVersion": "1.08",
"recipientAccountId": "123456789012",
"requestID": "req-123",
"sourceIPAddress": "203.0.113.50",
"userAgent": "aws-cli/2.15.0",
"userIdentity": {
"accessKeyId": "AKIAIOSFODNN7EXAMPLE",
"accountId": "123456789012",
"arn": "arn:aws:iam::123456789012:user/example-user",
"principalId": "AIDACKCEVSQ6C2EXAMPLE",
"type": "IAMUser",
"userName": "example-user"
}
}
- Name: GetSessionToken Failed
ExpectedResult: false
Log:
{
"awsRegion": "us-east-1",
"errorCode": "AccessDenied",
"eventName": "GetSessionToken",
"eventSource": "sts.amazonaws.com",
"eventTime": "2024-01-15T10:30:00Z",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012",
"sourceIPAddress": "203.0.113.50",
"userIdentity": {
"type": "IAMUser",
"userName": "example-user"
}
}
- Name: GetSessionToken by Assumed Role
ExpectedResult: false
Log:
{
"awsRegion": "us-east-1",
"eventName": "GetSessionToken",
"eventSource": "sts.amazonaws.com",
"eventTime": "2024-01-15T10:30:00Z",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012",
"sourceIPAddress": "10.0.0.1",
"userIdentity": {
"type": "AssumedRole",
"arn": "arn:aws:sts::123456789012:assumed-role/MyRole/session"
}
}
- Name: Unrelated STS Event
ExpectedResult: false
Log:
{
"awsRegion": "us-east-1",
"eventName": "AssumeRole",
"eventSource": "sts.amazonaws.com",
"eventTime": "2024-01-15T10:30:00Z",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012",
"sourceIPAddress": "10.0.0.1",
"userIdentity": {
"type": "IAMUser",
"userName": "example-user"
}
}
Detection logic
Condition
not (errorCode is_not_null or errorMessage is_not_null)
eventSource eq "sts.amazonaws.com"
eventName eq "GetSessionToken"
userIdentity.type eq "IAMUser"
Exclusions
Top-level NOT(...) conjuncts: predicates this rule actively suppresses.
| Field | Kind | Excluded values |
|---|---|---|
errorCode | is_not_null | |
errorMessage | is_not_null |
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
eventName | eq |
|
eventSource | eq |
|
userIdentity.type | eq |
|
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
eventName | |
eventSource | |
awsRegion | |
recipientAccountId | |
sourceIPAddress | |
userAgent | |
userIdentity | |
userName | userIdentity.userName |