AWS IAM Deactivation of MFA Device
Identifies the deactivation of a specified multi-factor authentication (MFA) device and removes it from association with the user name for which it was originally enabled. In AWS Identity and Access Management (IAM), a device must be deactivated before it can be deleted.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/05/26"
3integration = ["aws"]
4maturity = "production"
5updated_date = "2024/10/25"
6
7[rule]
8author = ["Elastic", "Austin Songer"]
9description = """
10Identifies the deactivation of a specified multi-factor authentication (MFA) device and removes it from association with
11the user name for which it was originally enabled. In AWS Identity and Access Management (IAM), a device must be
12deactivated before it can be deleted.
13"""
14false_positives = [
15 """
16 A MFA device may be deactivated by a system or network administrator. Verify whether the user identity, user agent,
17 and/or hostname should be making changes in your environment. MFA device deactivations from unfamiliar users or
18 hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
19 """,
20]
21from = "now-60m"
22index = ["filebeat-*", "logs-aws.cloudtrail-*"]
23interval = "10m"
24language = "kuery"
25license = "Elastic License v2"
26name = "AWS IAM Deactivation of MFA Device"
27note = """## Triage and analysis
28
29### Investigating AWS IAM Deactivation of MFA Device
30
31Multi-factor authentication (MFA) in AWS is a simple best practice that adds an extra layer of protection on top of your user name and password. With MFA enabled, when a user signs in to an AWS Management Console, they will be prompted for their user name and password (the first factor—what they know), as well as for an authentication code from their AWS MFA device (the second factor—what they have). Taken together, these multiple factors provide increased security for your AWS account settings and resources.
32
33For more information about using MFA in AWS, access the [official documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html).
34
35This rule looks for the deactivation or deletion of AWS MFA devices. These modifications weaken account security and can lead to the compromise of accounts and other assets.
36
37#### Possible investigation steps
38
39- Identify the user account that performed the action and whether it should perform this kind of action.
40- Investigate other alerts associated with the user account during the past 48 hours.
41- Contact the account and resource owners and confirm whether they are aware of this activity.
42- Check if this operation was approved and performed according to the organization's change management policy.
43- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.
44
45### False positive analysis
46
47- While this activity can be done by administrators, all users must use MFA. The security team should address any potential benign true positive (B-TP), as this configuration can risk the user and domain.
48
49### Response and remediation
50
51- Initiate the incident response process based on the outcome of the triage.
52- Disable or limit the account during the investigation and response.
53- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
54 - Identify the account role in the cloud environment.
55 - Assess the criticality of affected services and servers.
56 - Work with your IT team to identify and minimize the impact on users.
57 - Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
58 - Identify any regulatory or legal ramifications related to this activity.
59- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
60- Reactivate multi-factor authentication for the user.
61- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
62- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
63- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
64- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
65
66## Setup
67
68The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
69references = [
70 "https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iam/deactivate-mfa-device.html",
71 "https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeactivateMFADevice.html",
72]
73risk_score = 47
74rule_id = "d8fc1cca-93ed-43c1-bbb6-c0dd3eff2958"
75severity = "medium"
76tags = [
77 "Domain: Cloud",
78 "Data Source: AWS",
79 "Data Source: Amazon Web Services",
80 "Data Source: AWS IAM",
81 "Resources: Investigation Guide",
82 "Tactic: Impact",
83 "Tactic: Persistence",
84]
85timestamp_override = "event.ingested"
86type = "query"
87
88query = '''
89event.dataset:aws.cloudtrail and event.provider:iam.amazonaws.com and event.action:(DeactivateMFADevice or DeleteVirtualMFADevice) and event.outcome:success
90'''
91
92
93[[rule.threat]]
94framework = "MITRE ATT&CK"
95[[rule.threat.technique]]
96id = "T1531"
97name = "Account Access Removal"
98reference = "https://attack.mitre.org/techniques/T1531/"
99
100
101[rule.threat.tactic]
102id = "TA0040"
103name = "Impact"
104reference = "https://attack.mitre.org/tactics/TA0040/"
105[[rule.threat]]
106framework = "MITRE ATT&CK"
107[[rule.threat.technique]]
108id = "T1556"
109name = "Modify Authentication Process"
110reference = "https://attack.mitre.org/techniques/T1556/"
111[[rule.threat.technique.subtechnique]]
112id = "T1556.006"
113name = "Multi-Factor Authentication"
114reference = "https://attack.mitre.org/techniques/T1556/006/"
115
116
117[rule.threat.tactic]
118id = "TA0003"
119name = "Persistence"
120reference = "https://attack.mitre.org/tactics/TA0003/"
Triage and analysis
Investigating AWS IAM Deactivation of MFA Device
Multi-factor authentication (MFA) in AWS is a simple best practice that adds an extra layer of protection on top of your user name and password. With MFA enabled, when a user signs in to an AWS Management Console, they will be prompted for their user name and password (the first factor—what they know), as well as for an authentication code from their AWS MFA device (the second factor—what they have). Taken together, these multiple factors provide increased security for your AWS account settings and resources.
For more information about using MFA in AWS, access the official documentation.
This rule looks for the deactivation or deletion of AWS MFA devices. These modifications weaken account security and can lead to the compromise of accounts and other assets.
Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Investigate other alerts associated with the user account during the past 48 hours.
- Contact the account and resource owners and confirm whether they are aware of this activity.
- Check if this operation was approved and performed according to the organization's change management policy.
- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.
False positive analysis
- While this activity can be done by administrators, all users must use MFA. The security team should address any potential benign true positive (B-TP), as this configuration can risk the user and domain.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
- Identify the account role in the cloud environment.
- Assess the criticality of affected services and servers.
- Work with your IT team to identify and minimize the impact on users.
- Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
- Identify any regulatory or legal ramifications related to this activity.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
- Reactivate multi-factor authentication for the user.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices outlined by AWS.
- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
Setup
The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
References
Related rules
- AWS IAM AdministratorAccess Policy Attached to Group
- AWS IAM AdministratorAccess Policy Attached to Role
- AWS IAM CompromisedKeyQuarantine Policy Attached to User
- AWS IAM Roles Anywhere Profile Creation
- AWS IAM Roles Anywhere Trust Anchor Created with External CA