Skip to content

Commit 17186fc

Browse files
imays11tradebot-elastic
authored andcommitted
[Rule Tuning] AWS IAM API Calls via Temporary Session Tokens (#4901)
- rule triggers as expected, however its triggering for failed requests - added `event.outcome: success` to query - added highlighted fields - adjusted rule execution window (cherry picked from commit 494a9e0)
1 parent b1162c6 commit 17186fc

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

rules/integrations/aws/persistence_iam_api_calls_via_user_session_token.toml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
creation_date = "2025/04/16"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/04/16"
5+
updated_date = "2025/07/10"
66

77
[rule]
88
author = ["Elastic"]
99
description = """
10-
Detects use of sensitive AWS STS or IAM API operations using temporary credentials (session tokens starting with 'ASIA').
11-
This may indicate credential theft or abuse of elevated access via a stolen session. It is not common for legitimate users to perform sensitive IAM operations with temporary session tokens.
10+
Detects use of sensitive AWS IAM API operations using temporary credentials (session tokens starting with 'ASIA'). This may indicate credential theft or abuse of elevated access via a stolen session. It is not common for legitimate users to perform sensitive IAM operations with temporary session tokens.
1211
"""
1312
false_positives = [
1413
"""
1514
Some CI/CD pipelines or administrative users may use session tokens. Review user context, IP, and timing to validate.
1615
""",
1716
]
18-
from = "now-9m"
17+
from = "now-6m"
1918
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
2019
language = "kuery"
2120
license = "Elastic License v2"
@@ -29,15 +28,15 @@ This rule detects sensitive IAM API operations performed using temporary AWS cre
2928
3029
#### Possible investigation steps:
3130
32-
- Review aws.cloudtrail.user_identity.arn to determine which IAM user or assumed role initiated the request.
33-
- Check aws.cloudtrail.user_identity.access_key_id to confirm if the credential starts with 'ASIA', indicating a temporary session token.
34-
- Examine aws.cloudtrail.user_identity.session_context.mfa_authenticated to verify whether MFA was present during session creation.
35-
- Investigate source.ip to assess whether the request originated from a known network, office IP, or corporate VPN.
36-
- Look at user_agent.original to determine if the API call came from a known CLI version or unexpected tool (e.g., unknown SDK, custom script).
31+
- Review `aws.cloudtrail.user_identity.arn` to determine which IAM user or assumed role initiated the request.
32+
- Check `aws.cloudtrail.user_identity.access_key_id` to confirm if the credential starts with 'ASIA', indicating a temporary session token.
33+
- Examine `aws.cloudtrail.user_identity.session_context.mfa_authenticated` to verify whether MFA was present during session creation.
34+
- Investigate `source.ip` to assess whether the request originated from a known network, office IP, or corporate VPN.
35+
- Look at `user_agent.original` to determine if the API call came from a known CLI version or unexpected tool (e.g., unknown SDK, custom script).
3736
- Confirm whether a recent sts:GetSessionToken, sts:AssumeRole, or AWS SSO login event issued the temporary credential.
3837
- Correlate other events using the same access key ID to identify additional privileged actions, such as iam:CreateAccessKey, iam:PutUserPolicy, or iam:EnableMFADevice.
3938
- Analyze timing via @timestamp to determine if the action occurred during off-hours or deviates from normal user behavior.
40-
- Review the event.outcome to check if the API call was successful or failed, which may indicate unauthorized access attempts.
39+
- Review the `event.outcome` to check if the API call was successful or failed, which may indicate unauthorized access attempts.
4140
- Check for related events in the same session, such as iam:CreateUser, iam:AttachUserPolicy, or sts:GetCallerIdentity, to identify potential lateral movement or privilege escalation.
4241
4342
### False positive analysis:
@@ -77,10 +76,27 @@ type = "new_terms"
7776
query = '''
7877
event.dataset: aws.cloudtrail
7978
and event.provider: ("iam.amazonaws.com")
79+
and event.outcome: "success"
8080
and aws.cloudtrail.user_identity.type: "IAMUser"
8181
and aws.cloudtrail.user_identity.access_key_id: ASIA*
8282
'''
8383

84+
[rule.investigation_fields]
85+
field_names = [
86+
"@timestamp",
87+
"user.name",
88+
"user_agent.original",
89+
"source.ip",
90+
"aws.cloudtrail.user_identity.arn",
91+
"aws.cloudtrail.user_identity.type",
92+
"aws.cloudtrail.user_identity.access_key_id",
93+
"event.action",
94+
"event.outcome",
95+
"cloud.account.id",
96+
"cloud.region",
97+
"aws.cloudtrail.request_parameters"
98+
]
99+
84100
[[rule.threat]]
85101
framework = "MITRE ATT&CK"
86102

0 commit comments

Comments
 (0)