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"
 5min_stack_comments = "AWS integration breaking changes, bumping version to ^2.0.0"
 6min_stack_version = "8.9.0"
 7updated_date = "2024/04/14"
 8
 9[rule]
10author = ["Elastic", "Austin Songer"]
11description = """
12Identifies the deactivation of a specified multi-factor authentication (MFA) device and removes it from association with
13the user name for which it was originally enabled. In AWS Identity and Access Management (IAM), a device must be
14deactivated before it can be deleted.
15"""
16false_positives = [
17    """
18    A MFA device may be deactivated by a system or network administrator. Verify whether the user identity, user agent,
19    and/or hostname should be making changes in your environment. MFA device deactivations from unfamiliar users or
20    hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.
21    """,
22]
23from = "now-60m"
24index = ["filebeat-*", "logs-aws.cloudtrail-*"]
25interval = "10m"
26language = "kuery"
27license = "Elastic License v2"
28name = "AWS IAM Deactivation of MFA Device"
29note = """## Triage and analysis
30
31### Investigating AWS IAM Deactivation of MFA Device
32
33Multi-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.
34
35For more information about using MFA in AWS, access the [official documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html).
36
37This 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.
38
39#### Possible investigation steps
40
41- Identify the user account that performed the action and whether it should perform this kind of action.
42- Investigate other alerts associated with the user account during the past 48 hours.
43- Contact the account and resource owners and confirm whether they are aware of this activity.
44- Check if this operation was approved and performed according to the organization's change management policy.
45- 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.
46
47### False positive analysis
48
49- 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.
50
51### Response and remediation
52
53- Initiate the incident response process based on the outcome of the triage.
54- Disable or limit the account during the investigation and response.
55- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
56    - Identify the account role in the cloud environment.
57    - Assess the criticality of affected services and servers.
58    - Work with your IT team to identify and minimize the impact on users.
59    - Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
60    - Identify any regulatory or legal ramifications related to this activity.
61- 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.
62- Reactivate multi-factor authentication for the user.
63- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
64- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
65- Determine the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
66- 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).
67
68## Setup
69
70The AWS Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
71references = [
72    "https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iam/deactivate-mfa-device.html",
73    "https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeactivateMFADevice.html",
74]
75risk_score = 47
76rule_id = "d8fc1cca-93ed-43c1-bbb6-c0dd3eff2958"
77severity = "medium"
78tags = ["Domain: Cloud", "Data Source: AWS", "Data Source: Amazon Web Services", "Data Source: AWS IAM", "Resources: Investigation Guide", "Tactic: Impact"]
79timestamp_override = "event.ingested"
80type = "query"
81
82query = '''
83event.dataset:aws.cloudtrail and event.provider:iam.amazonaws.com and event.action:(DeactivateMFADevice or DeleteVirtualMFADevice) and event.outcome:success
84'''
85
86
87[[rule.threat]]
88framework = "MITRE ATT&CK"
89[[rule.threat.technique]]
90id = "T1531"
91name = "Account Access Removal"
92reference = "https://attack.mitre.org/techniques/T1531/"
93
94
95[rule.threat.tactic]
96id = "TA0040"
97name = "Impact"
98reference = "https://attack.mitre.org/tactics/TA0040/"

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

to-top