Detection rules › Splunk

Azure AD Device Code Authentication

Status
production
Severity
medium
Group by
aws::recipientAccountId, aws::userAgent, category, dest, src, user, vendor_product
Author
Mauricio Velazco, Gowthamaraj Rajendran, Splunk
Source
github.com/splunk/security_content

The following analytic identifies Azure Device Code Phishing attacks, which can lead to Azure Account Take-Over (ATO). It leverages Azure AD SignInLogs to detect suspicious authentication requests using the device code authentication protocol. This activity is significant as it indicates potential bypassing of Multi-Factor Authentication (MFA) and Conditional Access Policies (CAPs) through phishing emails. If confirmed malicious, attackers could gain unauthorized access to Azure AD, Exchange mailboxes, and Outlook Web Application (OWA), leading to potential data breaches and unauthorized data access.

Known false positives

  • In most organizations, device code authentication will be used to access common Microsoft service but it may be legitimate for others. Filter as needed.

MITRE ATT&CK coverage

Telemetry coverage

Rules detecting the same action

These rules filter on the same operation.

Rule body

name: Azure AD Device Code Authentication
id: d68d8732-6f7e-4ee5-a6eb-737f2b990b91
version: 12
creation_date: '2023-11-16'
modification_date: '2026-05-13'
author: Mauricio Velazco, Gowthamaraj Rajendran,  Splunk
status: production
type: TTP
description: The following analytic identifies Azure Device Code Phishing attacks, which can lead to Azure Account Take-Over (ATO). It leverages Azure AD SignInLogs to detect suspicious authentication requests using the device code authentication protocol. This activity is significant as it indicates potential bypassing of Multi-Factor Authentication (MFA) and Conditional Access Policies (CAPs) through phishing emails. If confirmed malicious, attackers could gain unauthorized access to Azure AD, Exchange mailboxes, and Outlook Web Application (OWA), leading to potential data breaches and unauthorized data access.
data_source:
    - Azure Active Directory
search: |-
    `azure_monitor_aad` category=SignInLogs "properties.authenticationProtocol"=deviceCode
      | rename properties.* as *
      | rename userAgent as user_agent
      | fillnull
      | stats count min(_time) as firstTime max(_time) as lastTime
        BY dest user src
           vendor_account vendor_product user_agent
           category
      | `security_content_ctime(firstTime)`
      | `security_content_ctime(lastTime)`
      | `azure_ad_device_code_authentication_filter`
how_to_implement: You must install the latest version of Splunk Add-on for Microsoft Cloud Services from Splunkbase (https://splunkbase.splunk.com/app/3110/#/details). You must be ingesting Azure Active Directory events into your Splunk environment through an EventHub. This analytic was written to be used with the azure:monitor:aad sourcetype leveraging the SignInLogs log category.
known_false_positives: In most organizations, device code authentication will be used to access common Microsoft service but it may be legitimate for others. Filter as needed.
references:
    - https://attack.mitre.org/techniques/T1528
    - https://github.com/rvrsh3ll/TokenTactics
    - https://embracethered.com/blog/posts/2022/device-code-phishing/
    - https://0xboku.com/2021/07/12/ArtOfDeviceCodePhish.html
    - https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code
finding:
    title: Device code requested for $user$ from $src$
    entity:
        field: user
        type: user
        score: 50
threat_objects:
    - field: src
      type: ip_address
analytic_story:
    - Azure Active Directory Account Takeover
asset_type: Azure Tenant
mitre_attack_id:
    - T1528
    - T1566.002
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: cloud
security_domain: identity

Stages and Predicates

Stage 1: search

`azure_monitor_aad` category=SignInLogs "properties.authenticationProtocol"=deviceCode

Stage 2: rename

| rename properties.* as *

Stage 3: rename

| rename userAgent as user_agent

Stage 4: fillnull

| fillnull

Stage 5: stats

| stats count min(_time) as firstTime max(_time) as lastTime
    BY dest user src
       vendor_account vendor_product user_agent
       category

Stage 6: search

| `security_content_ctime(firstTime)`

Stage 7: search

| `security_content_ctime(lastTime)`

Stage 8: search

| `azure_ad_device_code_authentication_filter`

Indicators

These rows show field, operator, and value matches.