Back
Id8fdfa0c5-0a81-4b07-a36b-311a3130090e
RulenameEntra ID security defaults disabled
DescriptionIdentifies when security defaults are turned off in Microsoft Entra ID.

Security defaults require all users to register for MFA, require MFA for administrators and when necessary for users, protect access to the Azure portal and other management tools, and block legacy authentication and device code flow.

An attacker with the Conditional Access Administrator role or higher can turn them off so that stolen passwords work without MFA.

Turning them off is also a normal step when moving to Conditional Access, so check for a planned change.

The alert shows the setting before and after the change.

Ref: https://learn.microsoft.com/entra/fundamentals/security-defaults
SeverityMedium
TacticsCredentialAccess
DefenseEvasion
Persistence
TechniquesT1556.006
Required data connectorsAzureActiveDirectory
KindScheduled
Query frequency1h
Query period2h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/SecurityDefaultsDisabled.yaml
Version1.0.0
Arm template8fdfa0c5-0a81-4b07-a36b-311a3130090e.json
Deploy To Azure
AuditLogs
| where TimeGenerated > ago(2h)
| where ingestion_time() > ago(1h)
| where OperationName =~ "Update security defaults"
| where Result !~ "failure"
| extend InitiatingAppName = tostring(InitiatedBy.app.displayName)
| extend InitiatingAppServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId)
| extend InitiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)
| extend InitiatingAadUserId = tostring(InitiatedBy.user.id)
| extend InitiatingIPAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))
| extend InitiatingAccountName = tostring(split(InitiatingUserPrincipalName, "@")[0]), InitiatingAccountUPNSuffix = tostring(split(InitiatingUserPrincipalName, "@")[1])
| extend TargetResourceName = tostring(TargetResources[0].displayName)
| extend TargetResourceType = tostring(TargetResources[0].type)
| extend ModifiedProperties = TargetResources[0].modifiedProperties
| mv-apply Property = ModifiedProperties on (
    extend PropertyOld = parse_json(tostring(Property.oldValue)), PropertyNew = parse_json(tostring(Property.newValue))
    | where isnotempty(tostring(PropertyNew.isEnabled)) or isnotempty(tostring(PropertyOld.isEnabled))
    | project SecurityDefaultsEnabledBefore = tostring(PropertyOld.isEnabled), SecurityDefaultsEnabledAfter = tostring(PropertyNew.isEnabled)
    | extend IsDisableChange = iff(SecurityDefaultsEnabledAfter =~ "false" and not(SecurityDefaultsEnabledBefore =~ "false"), 1, 0)
    | top 1 by IsDisableChange desc
    | project-away IsDisableChange
  )
| where SecurityDefaultsEnabledAfter =~ "false"
| where not(SecurityDefaultsEnabledBefore =~ "false")
| project-reorder TimeGenerated, OperationName, TargetResourceName, TargetResourceType, SecurityDefaultsEnabledBefore, SecurityDefaultsEnabledAfter, InitiatingUserPrincipalName, InitiatingAppName, InitiatingIPAddress, ModifiedProperties
metadata:
  categories:
    domains:
    - Security - Threat Protection
    - Identity
  author:
    name: descambiado
  source:
    kind: Community
  support:
    tier: Community
customDetails:
  TargetType: TargetResourceType
  TargetName: TargetResourceName
  Operation: OperationName
  EnabledAfter: SecurityDefaultsEnabledAfter
  InitiatingApp: InitiatingAppName
  EnabledBefore: SecurityDefaultsEnabledBefore
severity: Medium
requiredDataConnectors:
- connectorId: AzureActiveDirectory
  dataTypes:
  - AuditLogs
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/SecurityDefaultsDisabled.yaml
queryPeriod: 2h
queryFrequency: 1h
entityMappings:
- fieldMappings:
  - identifier: FullName
    columnName: InitiatingUserPrincipalName
  - identifier: Name
    columnName: InitiatingAccountName
  - identifier: UPNSuffix
    columnName: InitiatingAccountUPNSuffix
  entityType: Account
- fieldMappings:
  - identifier: AadUserId
    columnName: InitiatingAadUserId
  entityType: Account
- fieldMappings:
  - identifier: Address
    columnName: InitiatingIPAddress
  entityType: IP
kind: Scheduled
relevantTechniques:
- T1556.006
triggerOperator: gt
status: InPreview
query: |
  AuditLogs
  | where TimeGenerated > ago(2h)
  | where ingestion_time() > ago(1h)
  | where OperationName =~ "Update security defaults"
  | where Result !~ "failure"
  | extend InitiatingAppName = tostring(InitiatedBy.app.displayName)
  | extend InitiatingAppServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId)
  | extend InitiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)
  | extend InitiatingAadUserId = tostring(InitiatedBy.user.id)
  | extend InitiatingIPAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))
  | extend InitiatingAccountName = tostring(split(InitiatingUserPrincipalName, "@")[0]), InitiatingAccountUPNSuffix = tostring(split(InitiatingUserPrincipalName, "@")[1])
  | extend TargetResourceName = tostring(TargetResources[0].displayName)
  | extend TargetResourceType = tostring(TargetResources[0].type)
  | extend ModifiedProperties = TargetResources[0].modifiedProperties
  | mv-apply Property = ModifiedProperties on (
      extend PropertyOld = parse_json(tostring(Property.oldValue)), PropertyNew = parse_json(tostring(Property.newValue))
      | where isnotempty(tostring(PropertyNew.isEnabled)) or isnotempty(tostring(PropertyOld.isEnabled))
      | project SecurityDefaultsEnabledBefore = tostring(PropertyOld.isEnabled), SecurityDefaultsEnabledAfter = tostring(PropertyNew.isEnabled)
      | extend IsDisableChange = iff(SecurityDefaultsEnabledAfter =~ "false" and not(SecurityDefaultsEnabledBefore =~ "false"), 1, 0)
      | top 1 by IsDisableChange desc
      | project-away IsDisableChange
    )
  | where SecurityDefaultsEnabledAfter =~ "false"
  | where not(SecurityDefaultsEnabledBefore =~ "false")
  | project-reorder TimeGenerated, OperationName, TargetResourceName, TargetResourceType, SecurityDefaultsEnabledBefore, SecurityDefaultsEnabledAfter, InitiatingUserPrincipalName, InitiatingAppName, InitiatingIPAddress, ModifiedProperties
eventGroupingSettings:
  aggregationKind: AlertPerResult
name: Entra ID security defaults disabled
triggerThreshold: 0
version: 1.0.0
id: 8fdfa0c5-0a81-4b07-a36b-311a3130090e
description: |
  Identifies when security defaults are turned off in Microsoft Entra ID.
  Security defaults require all users to register for MFA, require MFA for administrators and when necessary for users, protect access to the Azure portal and other management tools, and block legacy authentication and device code flow.
  An attacker with the Conditional Access Administrator role or higher can turn them off so that stolen passwords work without MFA.
  Turning them off is also a normal step when moving to Conditional Access, so check for a planned change.
  The alert shows the setting before and after the change.
  Ref: https://learn.microsoft.com/entra/fundamentals/security-defaults
tactics:
- CredentialAccess
- DefenseEvasion
- Persistence
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2024-01-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/8fdfa0c5-0a81-4b07-a36b-311a3130090e')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/8fdfa0c5-0a81-4b07-a36b-311a3130090e')]",
      "properties": {
        "alertRuleTemplateName": "8fdfa0c5-0a81-4b07-a36b-311a3130090e",
        "customDetails": {
          "EnabledAfter": "SecurityDefaultsEnabledAfter",
          "EnabledBefore": "SecurityDefaultsEnabledBefore",
          "InitiatingApp": "InitiatingAppName",
          "Operation": "OperationName",
          "TargetName": "TargetResourceName",
          "TargetType": "TargetResourceType"
        },
        "description": "Identifies when security defaults are turned off in Microsoft Entra ID.\nSecurity defaults require all users to register for MFA, require MFA for administrators and when necessary for users, protect access to the Azure portal and other management tools, and block legacy authentication and device code flow.\nAn attacker with the Conditional Access Administrator role or higher can turn them off so that stolen passwords work without MFA.\nTurning them off is also a normal step when moving to Conditional Access, so check for a planned change.\nThe alert shows the setting before and after the change.\nRef: https://learn.microsoft.com/entra/fundamentals/security-defaults\n",
        "displayName": "Entra ID security defaults disabled",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "InitiatingUserPrincipalName",
                "identifier": "FullName"
              },
              {
                "columnName": "InitiatingAccountName",
                "identifier": "Name"
              },
              {
                "columnName": "InitiatingAccountUPNSuffix",
                "identifier": "UPNSuffix"
              }
            ]
          },
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "InitiatingAadUserId",
                "identifier": "AadUserId"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "InitiatingIPAddress",
                "identifier": "Address"
              }
            ]
          }
        ],
        "eventGroupingSettings": {
          "aggregationKind": "AlertPerResult"
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/SecurityDefaultsDisabled.yaml",
        "query": "AuditLogs\n| where TimeGenerated > ago(2h)\n| where ingestion_time() > ago(1h)\n| where OperationName =~ \"Update security defaults\"\n| where Result !~ \"failure\"\n| extend InitiatingAppName = tostring(InitiatedBy.app.displayName)\n| extend InitiatingAppServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId)\n| extend InitiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)\n| extend InitiatingAadUserId = tostring(InitiatedBy.user.id)\n| extend InitiatingIPAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))\n| extend InitiatingAccountName = tostring(split(InitiatingUserPrincipalName, \"@\")[0]), InitiatingAccountUPNSuffix = tostring(split(InitiatingUserPrincipalName, \"@\")[1])\n| extend TargetResourceName = tostring(TargetResources[0].displayName)\n| extend TargetResourceType = tostring(TargetResources[0].type)\n| extend ModifiedProperties = TargetResources[0].modifiedProperties\n| mv-apply Property = ModifiedProperties on (\n    extend PropertyOld = parse_json(tostring(Property.oldValue)), PropertyNew = parse_json(tostring(Property.newValue))\n    | where isnotempty(tostring(PropertyNew.isEnabled)) or isnotempty(tostring(PropertyOld.isEnabled))\n    | project SecurityDefaultsEnabledBefore = tostring(PropertyOld.isEnabled), SecurityDefaultsEnabledAfter = tostring(PropertyNew.isEnabled)\n    | extend IsDisableChange = iff(SecurityDefaultsEnabledAfter =~ \"false\" and not(SecurityDefaultsEnabledBefore =~ \"false\"), 1, 0)\n    | top 1 by IsDisableChange desc\n    | project-away IsDisableChange\n  )\n| where SecurityDefaultsEnabledAfter =~ \"false\"\n| where not(SecurityDefaultsEnabledBefore =~ \"false\")\n| project-reorder TimeGenerated, OperationName, TargetResourceName, TargetResourceType, SecurityDefaultsEnabledBefore, SecurityDefaultsEnabledAfter, InitiatingUserPrincipalName, InitiatingAppName, InitiatingIPAddress, ModifiedProperties\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "PT2H",
        "severity": "Medium",
        "status": "InPreview",
        "subTechniques": [
          "T1556.006"
        ],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "CredentialAccess",
          "DefenseEvasion",
          "Persistence"
        ],
        "techniques": [
          "T1556"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}