AWS IAM Deactivation of MFA Device
Detects the deactivation of a Multi-Factor Authentication (MFA) device in AWS Identity and Access Management (IAM). MFA provides critical protection against unauthorized access by requiring a second factor for authentication. Adversaries or compromised administrators may deactivate MFA devices to weaken account protections, disable strong authentication, or prepare for privilege escalation or persistence. This rule monitors successful DeactivateMFADevice API calls, which represent the point at which MFA protection is actually removed.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/05/26"
3integration = ["aws"]
4maturity = "production"
5updated_date = "2026/01/21"
6
7[rule]
8author = ["Elastic", "Austin Songer"]
9description = """
10Detects the deactivation of a Multi-Factor Authentication (MFA) device in AWS Identity and Access Management (IAM). MFA
11provides critical protection against unauthorized access by requiring a second factor for authentication. Adversaries or
12compromised administrators may deactivate MFA devices to weaken account protections, disable strong authentication, or
13prepare for privilege escalation or persistence. This rule monitors successful DeactivateMFADevice API calls, which
14represent the point at which MFA protection is actually removed.
15"""
16false_positives = [
17 """
18 MFA device deactivation may occur legitimately during device rotation, user offboarding, or troubleshooting. For
19 example, AWS requires deactivation of an existing MFA device before adding a replacement. These actions are often
20 performed by administrators following approved change-control processes. To reduce false positives, validate whether
21 the deactivation aligns with a documented workflow, known device replacement, or expected maintenance window. If
22 performed outside of expected operational hours, by an unexpected user, or from an unfamiliar source IP, this event
23 should be investigated for potential credential compromise or unauthorized tampering.
24 """,
25]
26from = "now-6m"
27index = ["filebeat-*", "logs-aws.cloudtrail-*"]
28language = "kuery"
29license = "Elastic License v2"
30name = "AWS IAM Deactivation of MFA Device"
31note = """## Triage and analysis
32
33### Investigating AWS IAM Deactivation of MFA Device
34
35This rule detects successful deactivation of a Virtual MFA device in AWS IAM.
36Deactivation removes MFA enforcement from an IAM user, significantly lowering account resilience against credential theft or unauthorized access.
37Since MFA devices must be deactivated before deletion, this represents the earliest and most critical opportunity to detect potential account compromise or persistence activity.
38
39For more information about using MFA in AWS, access the [official documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html).
40
41#### Possible investigation steps
42
43- **Identify the actor and context**
44 - Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id` to determine who initiated the deactivation.
45 - Check whether the actor typically manages MFA or has the IAM permissions to perform such actions.
46 - Review `user_agent.original` to confirm if the operation was performed via the AWS Console, CLI, or SDK.
47
48- **Review the source and location**
49 - Investigate `source.ip` and `source.geo` fields for unusual origins or unrecognized locations.
50 - Determine if this request originated from known automation infrastructure, internal IP ranges, or a personal endpoint.
51
52- **Correlate with other related activity**
53 - Look for preceding API calls such as `ListMFADevices`, `GetSessionToken`, or `ListUsers`, which may indicate reconnaissance or IAM enumeration.
54 - Search for subsequent `DeleteVirtualMFADevice` calls to confirm whether the deactivated device was later deleted — a common follow-up action.
55 - Check for any privilege changes, credential creations (`CreateAccessKey`, `AttachUserPolicy`), or unexpected login attempts following the deactivation.
56
57- **Validate authorization**
58 - Confirm with IAM or security administrators whether the action was part of an authorized device rotation or remediation.
59 - If not documented or approved, escalate as a potential credential compromise or persistence attempt.
60
61### False positive analysis
62
63- **Legitimate device rotation**
64 - When replacing an MFA device, AWS requires deactivation of the existing device before the new one can be enabled.
65- **Administrative maintenance**
66 - IAM administrators or automation pipelines may deactivate MFA as part of account management or recovery workflows.
67
68### Response and remediation
69
70- **Containment**
71 - Re-enable MFA for the affected IAM user (`EnableMFADevice`) or temporarily disable their login access until legitimacy is confirmed.
72 - Revoke temporary credentials or tokens associated with the actor to prevent further misuse.
73
74- **Investigation and scoping**
75 - Review CloudTrail history for additional IAM configuration changes or access key creation events tied to the same principal.
76 - Determine whether sensitive resources were accessed after MFA removal.
77 - Identify whether multiple users had MFA devices deactivated in a short timeframe — an indicator of broader compromise.
78
79- **Recovery and hardening**
80 - Require MFA for all privileged IAM users and enforce it using service control policies (SCPs).
81 - Enable GuardDuty or Security Hub findings for IAM anomaly detection related to account takeover or configuration changes.
82
83### Additional information
84- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
85- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
86- **[DeactivateMFADevice API Reference](https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeactivateMFADevice.html)**
87- **[Managing MFA Devices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html)**
88"""
89references = [
90 "https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iam/deactivate-mfa-device.html",
91 "https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeactivateMFADevice.html",
92]
93risk_score = 47
94rule_id = "d8fc1cca-93ed-43c1-bbb6-c0dd3eff2958"
95severity = "medium"
96tags = [
97 "Domain: Cloud",
98 "Data Source: AWS",
99 "Data Source: Amazon Web Services",
100 "Data Source: AWS CloudTrail",
101 "Data Source: AWS IAM",
102 "Resources: Investigation Guide",
103 "Tactic: Impact",
104 "Tactic: Persistence",
105]
106timestamp_override = "event.ingested"
107type = "query"
108
109query = '''
110event.dataset: aws.cloudtrail
111 and event.provider: iam.amazonaws.com
112 and event.action: DeactivateMFADevice
113 and event.outcome: success
114'''
115
116
117[[rule.threat]]
118framework = "MITRE ATT&CK"
119[[rule.threat.technique]]
120id = "T1531"
121name = "Account Access Removal"
122reference = "https://attack.mitre.org/techniques/T1531/"
123
124
125[rule.threat.tactic]
126id = "TA0040"
127name = "Impact"
128reference = "https://attack.mitre.org/tactics/TA0040/"
129[[rule.threat]]
130framework = "MITRE ATT&CK"
131[[rule.threat.technique]]
132id = "T1556"
133name = "Modify Authentication Process"
134reference = "https://attack.mitre.org/techniques/T1556/"
135[[rule.threat.technique.subtechnique]]
136id = "T1556.006"
137name = "Multi-Factor Authentication"
138reference = "https://attack.mitre.org/techniques/T1556/006/"
139
140
141
142[rule.threat.tactic]
143id = "TA0003"
144name = "Persistence"
145reference = "https://attack.mitre.org/tactics/TA0003/"
146
147[rule.investigation_fields]
148field_names = [
149 "@timestamp",
150 "user.name",
151 "user_agent.original",
152 "source.ip",
153 "aws.cloudtrail.user_identity.arn",
154 "aws.cloudtrail.user_identity.type",
155 "aws.cloudtrail.user_identity.access_key_id",
156 "event.action",
157 "event.outcome",
158 "cloud.account.id",
159 "cloud.region",
160 "aws.cloudtrail.request_parameters",
161]
Triage and analysis
Investigating AWS IAM Deactivation of MFA Device
This rule detects successful deactivation of a Virtual MFA device in AWS IAM. Deactivation removes MFA enforcement from an IAM user, significantly lowering account resilience against credential theft or unauthorized access. Since MFA devices must be deactivated before deletion, this represents the earliest and most critical opportunity to detect potential account compromise or persistence activity.
For more information about using MFA in AWS, access the official documentation.
Possible investigation steps
-
Identify the actor and context
- Review
aws.cloudtrail.user_identity.arnandaws.cloudtrail.user_identity.access_key_idto determine who initiated the deactivation. - Check whether the actor typically manages MFA or has the IAM permissions to perform such actions.
- Review
user_agent.originalto confirm if the operation was performed via the AWS Console, CLI, or SDK.
- Review
-
Review the source and location
- Investigate
source.ipandsource.geofields for unusual origins or unrecognized locations. - Determine if this request originated from known automation infrastructure, internal IP ranges, or a personal endpoint.
- Investigate
-
Correlate with other related activity
- Look for preceding API calls such as
ListMFADevices,GetSessionToken, orListUsers, which may indicate reconnaissance or IAM enumeration. - Search for subsequent
DeleteVirtualMFADevicecalls to confirm whether the deactivated device was later deleted — a common follow-up action. - Check for any privilege changes, credential creations (
CreateAccessKey,AttachUserPolicy), or unexpected login attempts following the deactivation.
- Look for preceding API calls such as
-
Validate authorization
- Confirm with IAM or security administrators whether the action was part of an authorized device rotation or remediation.
- If not documented or approved, escalate as a potential credential compromise or persistence attempt.
False positive analysis
- Legitimate device rotation
- When replacing an MFA device, AWS requires deactivation of the existing device before the new one can be enabled.
- Administrative maintenance
- IAM administrators or automation pipelines may deactivate MFA as part of account management or recovery workflows.
Response and remediation
-
Containment
- Re-enable MFA for the affected IAM user (
EnableMFADevice) or temporarily disable their login access until legitimacy is confirmed. - Revoke temporary credentials or tokens associated with the actor to prevent further misuse.
- Re-enable MFA for the affected IAM user (
-
Investigation and scoping
- Review CloudTrail history for additional IAM configuration changes or access key creation events tied to the same principal.
- Determine whether sensitive resources were accessed after MFA removal.
- Identify whether multiple users had MFA devices deactivated in a short timeframe — an indicator of broader compromise.
-
Recovery and hardening
- Require MFA for all privileged IAM users and enforce it using service control policies (SCPs).
- Enable GuardDuty or Security Hub findings for IAM anomaly detection related to account takeover or configuration changes.
Additional information
References
Related rules
- AWS IAM API Calls via Temporary Session Tokens
- AWS IAM Virtual MFA Device Registration Attempt with Session Token
- AWS IAM Roles Anywhere Trust Anchor Created with External CA
- AWS IAM AdministratorAccess Policy Attached to Group
- AWS IAM AdministratorAccess Policy Attached to Role