AWS IAM Virtual MFA Device Registration Attempt with Session Token
Detects attempts to create or enable a Virtual MFA device (CreateVirtualMFADevice, EnableMFADevice) using temporary AWS credentials (access keys beginning with ASIA). Session credentials are short-lived and tied to existing authenticated sessions, so using them to register or enable MFA devices is unusual. Adversaries who compromise temporary credentials may abuse this behavior to establish persistence by attaching new MFA devices to maintain access to high-privilege accounts despite key rotation or password resets.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2025/04/11"
3integration = ["aws"]
4maturity = "production"
5updated_date = "2026/01/16"
6
7[rule]
8author = ["Elastic"]
9description = """
10Detects attempts to create or enable a Virtual MFA device (CreateVirtualMFADevice, EnableMFADevice) using temporary AWS
11credentials (access keys beginning with ASIA). Session credentials are short-lived and tied to existing authenticated
12sessions, so using them to register or enable MFA devices is unusual. Adversaries who compromise temporary credentials
13may abuse this behavior to establish persistence by attaching new MFA devices to maintain access to high-privilege
14accounts despite key rotation or password resets.
15"""
16false_positives = [
17 """
18 Some legitimate administrative workflows or CI/CD automation pipelines may temporarily configure or re-enable MFA
19 devices using session-based credentials. Validate the calling identity’s purpose, source IP, and user agent to
20 confirm whether this activity was authorized. Additionally, when a user creates or enables a Virtual MFA device
21 through the AWS Management Console, the underlying CloudTrail event will also show a temporary credential (access
22 key ID beginning with ASIA), because the console itself issues short-lived STS session credentials for every
23 logged-in user. These events are expected and should not be considered suspicious.
24 """,
25]
26from = "now-6m"
27index = ["filebeat-*", "logs-aws.cloudtrail-*"]
28language = "eql"
29license = "Elastic License v2"
30name = "AWS IAM Virtual MFA Device Registration Attempt with Session Token"
31note = """## Triage and Analysis
32
33### Investigating AWS IAM Virtual MFA Device Registration Attempt with Session Token
34
35Temporary credentials that start with the prefix `ASIA` are generated by the AWS Security Token Service (STS). These
36session tokens are used for short-lived operations and should not be used to modify or register IAM
37authentication mechanisms. This rule detects cases where an IAM user or role uses such temporary credentials to invoke either `CreateVirtualMFADevice` or `EnableMFADevice`.
38
39#### Possible investigation steps
40
41- **Identify the actor and session context**
42 - Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id` to determine the identity and confirm the `ASIA` prefix.
43 - If you ingest `event.original`, look for `sessionCredentialFromConsole: true` to determine if the temporary token is from a console login session (which uses temporary session tokens in the backend) rather than compromised session tokens.
44 - Check `user_agent.original`, `source.ip`, and `cloud.region` to determine if this activity originated from an expected host, VPN, or location.
45 - Cross-reference with prior activity by this identity—especially `GetSessionToken`, `AssumeRole`, or `GetCallerIdentity` calls.
46
47- **Correlate related IAM events**
48 - Search for subsequent or preceding calls to:
49 - `EnableMFADevice` (after `CreateVirtualMFADevice`)
50 - `DeactivateMFADevice` or `DeleteVirtualMFADevice`
51 - `ListMFADevices`, `ListUsers`, or `UpdateLoginProfile`
52 - Review whether new MFA devices were successfully enabled (`event.outcome:success`).
53
54- **Assess session scope and privileges**
55 - Identify what IAM policies are attached to the user or role that issued this request.
56 - If the temporary credentials were created via `AssumeRole` or `GetSessionToken`, check the originating principal’s permissions.
57
58- **Investigate possible persistence**
59 - Look for new MFA devices listed for privileged users (e.g., account root or admin roles).
60 - Review login history for those accounts following the MFA change.
61
62### False positive analysis
63
64- **Legitimate Administrative or Automated Actions**
65 Certain IAM administrative workflows or CI/CD automation tools may register or enable MFA devices using temporary
66 session credentials. Confirm whether the calling principal is part of an authorized automation process or a known
67 identity performing account configuration tasks.
68
69- **Expected Console Behavior**
70 When users create or enable Virtual MFA devices through the **AWS Management Console**, AWS automatically issues
71 temporary STS credentials (with access key IDs beginning with `ASIA`) for that session. As a result, these events will
72 appear identical to programmatic usage of session tokens in CloudTrail logs.
73 This is expected and does not indicate compromise.
74
75### Response and remediation
76
77- **Immediate containment**
78 - Revoke or expire the temporary credentials (`aws sts revoke-session` if applicable).
79 - Disable or delete any newly created virtual MFA devices using `DeleteVirtualMFADevice`.
80 - Rotate passwords and long-term access keys for the associated IAM users.
81
82- **Investigation and scoping**
83 - Review CloudTrail logs for related IAM modifications (`UpdateLoginProfile`, `AttachUserPolicy`, `CreateAccessKey`).
84 - Identify any new API keys or tokens created after the MFA registration.
85 - Cross-check whether the attacker leveraged the new MFA binding for session persistence or login.
86
87- **Recovery and hardening**
88 - Enforce the `iam:EnableMFADevice` and `iam:CreateVirtualMFADevice` permissions only for trusted admin roles.
89 - Implement `aws:MultiFactorAuthPresent` conditions in IAM policies.
90 - Monitor for any future `ASIA` credential–based IAM configuration changes.
91
92### Additional information
93- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
94- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
95- **[Managing MFA Devices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html)**
96"""
97references = ["https://www.sygnia.co/blog/sygnia-investigation-bybit-hack/"]
98risk_score = 47
99rule_id = "e4feea34-3b62-4c83-b77f-018fbef48c00"
100severity = "medium"
101tags = [
102 "Domain: Cloud",
103 "Data Source: AWS",
104 "Data Source: Amazon Web Services",
105 "Data Source: AWS CloudTrail",
106 "Data Source: AWS IAM",
107 "Tactic: Persistence",
108 "Use Case: Identity and Access Audit",
109 "Resources: Investigation Guide",
110]
111timestamp_override = "event.ingested"
112type = "eql"
113
114query = '''
115iam where event.dataset == "aws.cloudtrail"
116 and event.provider == "iam.amazonaws.com"
117 and event.outcome == "success"
118 and event.action in ("CreateVirtualMFADevice", "EnableMFADevice")
119 and startsWith (aws.cloudtrail.user_identity.access_key_id, "ASIA")
120'''
121
122
123[[rule.threat]]
124framework = "MITRE ATT&CK"
125[[rule.threat.technique]]
126id = "T1098"
127name = "Account Manipulation"
128reference = "https://attack.mitre.org/techniques/T1098/"
129[[rule.threat.technique.subtechnique]]
130id = "T1098.005"
131name = "Device Registration"
132reference = "https://attack.mitre.org/techniques/T1098/005/"
133
134
135[[rule.threat.technique]]
136id = "T1556"
137name = "Modify Authentication Process"
138reference = "https://attack.mitre.org/techniques/T1556/"
139[[rule.threat.technique.subtechnique]]
140id = "T1556.006"
141name = "Multi-Factor Authentication"
142reference = "https://attack.mitre.org/techniques/T1556/006/"
143
144
145
146[rule.threat.tactic]
147id = "TA0003"
148name = "Persistence"
149reference = "https://attack.mitre.org/tactics/TA0003/"
150
151[rule.investigation_fields]
152field_names = [
153 "@timestamp",
154 "user.name",
155 "user_agent.original",
156 "source.ip",
157 "aws.cloudtrail.user_identity.arn",
158 "aws.cloudtrail.user_identity.type",
159 "aws.cloudtrail.user_identity.access_key_id",
160 "event.action",
161 "event.outcome",
162 "cloud.account.id",
163 "cloud.region",
164 "aws.cloudtrail.request_parameters",
165 "aws.cloudtrail.response_elements",
166]
Triage and Analysis
Investigating AWS IAM Virtual MFA Device Registration Attempt with Session Token
Temporary credentials that start with the prefix ASIA are generated by the AWS Security Token Service (STS). These
session tokens are used for short-lived operations and should not be used to modify or register IAM
authentication mechanisms. This rule detects cases where an IAM user or role uses such temporary credentials to invoke either CreateVirtualMFADevice or EnableMFADevice.
Possible investigation steps
-
Identify the actor and session context
- Review
aws.cloudtrail.user_identity.arnandaws.cloudtrail.user_identity.access_key_idto determine the identity and confirm theASIAprefix. - If you ingest
event.original, look forsessionCredentialFromConsole: trueto determine if the temporary token is from a console login session (which uses temporary session tokens in the backend) rather than compromised session tokens. - Check
user_agent.original,source.ip, andcloud.regionto determine if this activity originated from an expected host, VPN, or location. - Cross-reference with prior activity by this identity—especially
GetSessionToken,AssumeRole, orGetCallerIdentitycalls.
- Review
-
Correlate related IAM events
- Search for subsequent or preceding calls to:
EnableMFADevice(afterCreateVirtualMFADevice)DeactivateMFADeviceorDeleteVirtualMFADeviceListMFADevices,ListUsers, orUpdateLoginProfile
- Review whether new MFA devices were successfully enabled (
event.outcome:success).
- Search for subsequent or preceding calls to:
-
Assess session scope and privileges
- Identify what IAM policies are attached to the user or role that issued this request.
- If the temporary credentials were created via
AssumeRoleorGetSessionToken, check the originating principal’s permissions.
-
Investigate possible persistence
- Look for new MFA devices listed for privileged users (e.g., account root or admin roles).
- Review login history for those accounts following the MFA change.
False positive analysis
-
Legitimate Administrative or Automated Actions
Certain IAM administrative workflows or CI/CD automation tools may register or enable MFA devices using temporary session credentials. Confirm whether the calling principal is part of an authorized automation process or a known identity performing account configuration tasks. -
Expected Console Behavior
When users create or enable Virtual MFA devices through the AWS Management Console, AWS automatically issues temporary STS credentials (with access key IDs beginning withASIA) for that session. As a result, these events will appear identical to programmatic usage of session tokens in CloudTrail logs.
This is expected and does not indicate compromise.
Response and remediation
-
Immediate containment
- Revoke or expire the temporary credentials (
aws sts revoke-sessionif applicable). - Disable or delete any newly created virtual MFA devices using
DeleteVirtualMFADevice. - Rotate passwords and long-term access keys for the associated IAM users.
- Revoke or expire the temporary credentials (
-
Investigation and scoping
- Review CloudTrail logs for related IAM modifications (
UpdateLoginProfile,AttachUserPolicy,CreateAccessKey). - Identify any new API keys or tokens created after the MFA registration.
- Cross-check whether the attacker leveraged the new MFA binding for session persistence or login.
- Review CloudTrail logs for related IAM modifications (
-
Recovery and hardening
- Enforce the
iam:EnableMFADeviceandiam:CreateVirtualMFADevicepermissions only for trusted admin roles. - Implement
aws:MultiFactorAuthPresentconditions in IAM policies. - Monitor for any future
ASIAcredential–based IAM configuration changes.
- Enforce the
Additional information
References
Related rules
- AWS IAM API Calls via Temporary Session Tokens
- AWS IAM AdministratorAccess Policy Attached to Group
- AWS IAM AdministratorAccess Policy Attached to Role
- AWS IAM AdministratorAccess Policy Attached to User
- AWS IAM Group Creation