Files
sigma-rules/rules/integrations/aws/impact_iam_deactivate_mfa_device.toml
T
Isai 544c1914d4 [Rule Tuning] AWS IAM Virtual MFA Device Rules (#5275)
### AWS IAM Virtual MFA Device Registration Attempt with Session Token
- rule change kql to eql so that I could use startsWith function instead of wildcard for the `ASIA*`, temporary session determination.
- there is a known false positive for rules like this. When you login to the AWS console, a temporary session token is created in the back-end so in cloudtrail the token id looks the same (`ASIA*`) as temporary session tokens created by actions like `GetSessionToken` or `AssumeRole`, which is what this rule meant to capture. Our current data source does now allow us to distinguigh between these type of events. However, cloudtrail does provide a field `sessionCredentialFromConsole:true` that I am putting in a request for Integrations to include. This would allow us to exclude Console login sessions from rules like this that look for temporary token abuse.
- reduced execution window
- updated description, FP and IG
- update MITRE mapping
- added highlighted fields

AWS IAM Deactivation of MFA Device
- removed `DeleteVirtualMFADevice` from the scope of this rule. When Deleting an MFA device you must deactivate it first if it is associated with a user. You can also Create an MFA device and then Delete it without it being activated for a particular user. By capturing both Deactivation and Deletion events we have duplicate alerts for the same activity (This duplication of events is seen in telemetry.) We also capture benign instances where un-used MFA devices are deleted (which is a clean-up best practice). By reducing the scope to only `DeactivateMFADevice` actions, we capture the most threat-centric behavior which should be investigated.
- reduced execution window
- updated Description, FP and IG
- added highlighted fields
2025-11-17 15:13:48 -05:00

168 lines
7.4 KiB
TOML

[metadata]
creation_date = "2020/05/26"
integration = ["aws"]
maturity = "production"
updated_date = "2025/11/03"
[rule]
author = ["Elastic", "Austin Songer"]
description = """
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.
"""
false_positives = [
"""
MFA device deactivation may occur legitimately during device rotation, user offboarding, or troubleshooting. For
example, AWS requires deactivation of an existing MFA device before adding a replacement. These actions are often
performed by administrators following approved change-control processes. To reduce false positives, validate whether
the deactivation aligns with a documented workflow, known device replacement, or expected maintenance window. If
performed outside of expected operational hours, by an unexpected user, or from an unfamiliar source IP, this event
should be investigated for potential credential compromise or unauthorized tampering.
""",
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "AWS IAM Deactivation of MFA Device"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and validated for accuracy and relevance. Always
> tailor the steps to your organization's environment and operational context.
### 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](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html).
#### Possible investigation steps
- **Identify the actor and context**
- Review `aws.cloudtrail.user_identity.arn` and `aws.cloudtrail.user_identity.access_key_id` to determine who initiated the deactivation.
- Check whether the actor typically manages MFA or has the IAM permissions to perform such actions.
- Review `user_agent.original` to confirm if the operation was performed via the AWS Console, CLI, or SDK.
- **Review the source and location**
- Investigate `source.ip` and `source.geo` fields for unusual origins or unrecognized locations.
- Determine if this request originated from known automation infrastructure, internal IP ranges, or a personal endpoint.
- **Correlate with other related activity**
- Look for preceding API calls such as `ListMFADevices`, `GetSessionToken`, or `ListUsers`, which may indicate reconnaissance or IAM enumeration.
- Search for subsequent `DeleteVirtualMFADevice` calls 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.
- **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.
- **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
- **[AWS IR Playbooks](https://github.com/aws-samples/aws-incident-response-playbooks/blob/c151b0dc091755fffd4d662a8f29e2f6794da52c/playbooks/)**
- **[AWS Customer Playbook Framework](https://github.com/aws-samples/aws-customer-playbook-framework/tree/a8c7b313636b406a375952ac00b2d68e89a991f2/docs)**
- **[DeactivateMFADevice API Reference](https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeactivateMFADevice.html)**
- **[Managing MFA Devices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html)**
"""
references = [
"https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iam/deactivate-mfa-device.html",
"https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeactivateMFADevice.html",
]
risk_score = 47
rule_id = "d8fc1cca-93ed-43c1-bbb6-c0dd3eff2958"
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS CloudTrail",
"Data Source: AWS IAM",
"Resources: Investigation Guide",
"Tactic: Impact",
"Tactic: Persistence",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.dataset: aws.cloudtrail
and event.provider: iam.amazonaws.com
and event.action: DeactivateMFADevice
and event.outcome: success
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1531"
name = "Account Access Removal"
reference = "https://attack.mitre.org/techniques/T1531/"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1556"
name = "Modify Authentication Process"
reference = "https://attack.mitre.org/techniques/T1556/"
[[rule.threat.technique.subtechnique]]
id = "T1556.006"
name = "Multi-Factor Authentication"
reference = "https://attack.mitre.org/techniques/T1556/006/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.access_key_id",
"target.entity.id",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
"aws.cloudtrail.request_parameters",
]