|
| 1 | +[metadata] |
| 2 | +creation_date = "2025/07/14" |
| 3 | +integration = ["azure"] |
| 4 | +maturity = "production" |
| 5 | +updated_date = "2025/07/14" |
| 6 | + |
| 7 | +[rule] |
| 8 | +author = ["Elastic"] |
| 9 | +description = """ |
| 10 | +Identifies when an external authentication method (EAM) is added or modified in Entra ID. EAM may allow adversaries to |
| 11 | +bypass multi-factor authentication (MFA) requirements, potentially leading to unauthorized access to user accounts and |
| 12 | +sensitive resources by using bring-your-own IdP (BYOIDP) methods. |
| 13 | +""" |
| 14 | +from = "now-9m" |
| 15 | +index = ["filebeat-*", "logs-azure.graphactivitylogs-*"] |
| 16 | +language = "kuery" |
| 17 | +license = "Elastic License v2" |
| 18 | +name = "External Authentication Method Addition or Modification in Entra ID" |
| 19 | +note = """## Triage and analysis |
| 20 | +
|
| 21 | +### Investigating External Authentication Method Addition or Modification in Entra ID |
| 22 | +
|
| 23 | +This rule detects suspicious modifications to external authentication methods (EAMs) in Microsoft Entra ID via Microsoft Graph API. Adversaries may abuse this capability to bypass multi-factor authentication (MFA), enabling persistence or unauthorized access through bring-your-own identity provider (BYOIDP) methods. |
| 24 | +
|
| 25 | +### Possible investigation steps |
| 26 | +- Validate that `event.action` is `"Microsoft Graph Activity"` and that `http.request.method` is `"PATCH"`, indicating a configuration change was made. |
| 27 | +- Confirm that `url.path` contains the string `authenticationMethodsPolicy`, which is associated with external authentication settings in Entra ID. |
| 28 | +- Review `user.id` to identify the Azure AD object ID of the user or service principal that initiated the change. |
| 29 | +- Examine `azure.graphactivitylogs.properties.app_id` to determine the application ID that performed the action. |
| 30 | +- Analyze `azure.graphactivitylogs.properties.scopes[]` to assess whether the request used privileged scopes such as `AuthenticationMethod.ReadWrite.All`. |
| 31 | +- Review the geographic origin of the request using `source.geo.*` and the `source.ip` field to identify anomalous locations. |
| 32 | +- Examine `user_agent.original` to determine whether the request was made through a browser or automation (e.g., scripted activity). |
| 33 | +- Correlate `azure.graphactivitylogs.properties.token_issued_at` and `azure.graphactivitylogs.properties.time_generated` to assess whether the change occurred shortly after token issuance. |
| 34 | +- Investigate additional activity by the same `user.id` or `app_id` within a short timeframe (e.g., 30 minutes) to detect related suspicious behavior. |
| 35 | +- Use the `operation_id` or `correlation_id` to pivot across related Graph API or Entra ID activity logs, if available. |
| 36 | +
|
| 37 | +### False positive analysis |
| 38 | +- Legitimate administrative activity may trigger this rule, such as configuring FIDO2 or enabling passwordless sign-in methods during onboarding or security upgrades. |
| 39 | +- Some enterprise integrations or federated identity providers may programmatically update EAM settings as part of legitimate operations. |
| 40 | +- Routine security assessments or red team exercises may include changes to authentication policies. Validate with internal teams when in doubt. |
| 41 | +- If appropriate, filter or suppress alerts originating from known trusted service principals or administrative accounts. |
| 42 | +
|
| 43 | +### Response and remediation |
| 44 | +- Confirm whether the user or application that made the change was authorized to do so. If not, immediately revoke access and reset credentials as needed. |
| 45 | +- Review the application or automation that triggered the change to ensure it is legitimate. If unauthorized, disable or remove it and rotate secrets or tokens it may have accessed. |
| 46 | +- Audit current external authentication configurations and conditional access policies to ensure no persistent backdoors were introduced. |
| 47 | +- Revoke session tokens associated with the change using Entra ID's portal or Microsoft Graph API, and enforce reauthentication where appropriate. |
| 48 | +- Implement stricter RBAC or conditional access policies to prevent unauthorized EAM changes in the future. |
| 49 | +- Monitor for repeat or similar activity from the same source or identity as part of an ongoing compromise assessment. |
| 50 | +""" |
| 51 | +references = ["https://dirkjanm.io/persisting-with-federated-credentials-entra-apps-managed-identities/"] |
| 52 | +risk_score = 47 |
| 53 | +rule_id = "42c97e6e-60c3-11f0-832a-f661ea17fbcd" |
| 54 | +severity = "medium" |
| 55 | +tags = [ |
| 56 | + "Domain: Cloud", |
| 57 | + "Domain: Identity", |
| 58 | + "Data Source: Azure", |
| 59 | + "Data Source: Microsoft Graph", |
| 60 | + "Data Source: Microsoft Graph Activity Logs", |
| 61 | + "Use Case: Identity and Access Audit", |
| 62 | + "Resources: Investigation Guide", |
| 63 | + "Tactic: Persistence", |
| 64 | +] |
| 65 | +timestamp_override = "event.ingested" |
| 66 | +type = "new_terms" |
| 67 | + |
| 68 | +query = ''' |
| 69 | +event.dataset: azure.graphactivitylogs and |
| 70 | + url.path: *authenticationMethodsPolicy* and |
| 71 | + http.request.method: "PATCH" and |
| 72 | + http.response.status_code: 200 |
| 73 | +''' |
| 74 | + |
| 75 | + |
| 76 | +[[rule.threat]] |
| 77 | +framework = "MITRE ATT&CK" |
| 78 | +[[rule.threat.technique]] |
| 79 | +id = "T1556" |
| 80 | +name = "Modify Authentication Process" |
| 81 | +reference = "https://attack.mitre.org/techniques/T1556/" |
| 82 | +[[rule.threat.technique.subtechnique]] |
| 83 | +id = "T1556.009" |
| 84 | +name = "Conditional Access Policies" |
| 85 | +reference = "https://attack.mitre.org/techniques/T1556/009/" |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +[rule.threat.tactic] |
| 90 | +id = "TA0003" |
| 91 | +name = "Persistence" |
| 92 | +reference = "https://attack.mitre.org/tactics/TA0003/" |
| 93 | + |
| 94 | +[rule.new_terms] |
| 95 | +field = "new_terms_fields" |
| 96 | +value = ["azure.graphactivitylogs.properties.user_principal_object_id"] |
| 97 | +[[rule.new_terms.history_window_start]] |
| 98 | +field = "history_window_start" |
| 99 | +value = "now-7d" |
| 100 | + |
| 101 | + |
0 commit comments