Entra ID AiTM Phishing-Kit Chain Detected
editEntra ID AiTM Phishing-Kit Chain Detected
editIdentifies a Microsoft Entra ID identity-compromise chain in which a single user, within a 10-minute window, authenticates to the Device Registration Service through the Microsoft Authentication Broker (MAB) client, registers a device, and then uses the resulting Primary Refresh Token (PRT) to access a resource other than the Device Registration Service. This sequence is the core post-adversary-in-the-middle (AiTM) persistence pattern used by phishing kits such as Tycoon2FA and Kali365: after capturing a victim session, the kit registers an Azure AD-joined device to obtain a device-bound PRT, which survives user-level session revocation and password resets and grants trusted, MFA-free access. Correlating the broker sign-in, the device-registration audit event, and the follow-on PRT sign-in for the same user within a short window is a high-fidelity indicator of active account takeover.
Rule type: eql
Rule indices:
- logs-azure.signinlogs-*
- logs-azure.auditlogs-*
Severity: high
Risk score: 73
Runs every: 5m
Searches indices from: now-15m (Date Math format, see also Additional look-back time)
Maximum alerts per execution: 100
References:
- https://any.run/malware-trends/tycoon/
- https://www.huntress.com/blog/kali365-device-code-phishing-kit
- https://any.run/malware-trends/kali365/
- https://arcticwolf.com/resources/blog/token-bingo-dont-let-your-code-be-the-winner/
- https://www.elastic.co/security-labs/tycoon-2fa-aitm-detection-engineering
Tags:
- Domain: Cloud
- Domain: Identity
- Data Source: Azure
- Data Source: Microsoft Entra ID
- Data Source: Microsoft Entra ID Sign-In Logs
- Data Source: Microsoft Entra ID Audit Logs
- Use Case: Identity and Access Audit
- Use Case: Threat Detection
- Tactic: Persistence
- Tactic: Credential Access
- Resources: Investigation Guide
Version: 1
Rule authors:
- Elastic
Rule license: Elastic License v2
Investigation guide
editTriage and analysis
Investigating Entra ID AiTM Phishing-Kit Chain Detected
This rule correlates three events for the same user within a 10-minute window that together represent the canonical post-AiTM identity-compromise chain:
-
A non-interactive sign-in through the Microsoft Authentication Broker (MAB) client (
app_id29d9ed98-a469-4536-ade2-f981bc1d605e) to theDevice Registration Serviceresource, with anunboundsession token (token_protection_status_details.sign_in_session_status). -
A successful
Register deviceaudit event initiated by the same user for a target device namedDESKTOP-*. -
An interactive sign-in using a
primaryRefreshToken(PRT) to a resource other than the Device Registration Service, from an unmanaged device.
After an AiTM kit captures a victim session, it registers an Azure AD-joined device to obtain a device-bound PRT. Because the PRT is bound to the device rather than the user session, it survives revokeSignInSessions and password resets, providing durable, MFA-free access. Observing the broker-to-DRS auth, the registration, and the first PRT use in quick succession is strong evidence of active account takeover rather than benign onboarding.
Possible investigation steps
-
Identify the user via
azure.signinlogs.properties.user_principal_name/azure.signinlogs.properties.user_idand the registered device via theRegister deviceevent (azure.auditlogs.properties.target_resources.0.display_name). DefaultDESKTOP-<random>names that do not match your convention are suspicious. -
Review the source of each step:
source.ip,source.as.organization.name, andsource.geo.*. Hosting/VPS ASNs (for example Tencent or Alibaba) and unexpected geographies, or a single source driving all three steps, are high-fidelity suspicious. -
Inspect the registration user agent on the
Register deviceevent (azure.auditlogs.properties.userAgent); a spoofedDsreg/10.0 (Windows <build>)string or a raw HTTP client such asaxios/*orpython-requests/*indicates tooling. -
Confirm the PRT step:
azure.signinlogs.properties.incoming_token_typeisprimaryRefreshToken, the devicetrust_typeisAzure AD joined, anddevice_detail.is_managedis false (unmanaged), and theresource_display_nameis a real resource (Microsoft Graph, Office 365 Exchange Online, etc.) rather than the Device Registration Service. -
Check for additional persistence established in the same window: an attacker-registered MFA method (
User registered security info), multiple device registrations by the same user, or broker tokens minted for other resources. - Review Conditional Access outcomes to determine whether device compliance or MFA was bypassed.
False positive analysis
- Legitimate Azure AD join / device onboarding can produce a broker-to-DRS auth followed by PRT issuance. Validate the device against inventory and confirm it is managed/compliant and registered from an expected source.
- Authorized security assessments that register devices and exercise PRTs will match. Document and add scoped exceptions.
Response and remediation
-
Treat as likely account takeover. Remove the rogue device registration BEFORE revoking sessions, because device-bound PRTs survive
revokeSignInSessionsand a device left in place re-establishes access. -
GET /v1.0/users/{id}/registeredDevicesand/ownedDevices, thenDELETE /v1.0/devices/{deviceObjectId}for unrecognized devices. - Revoke refresh tokens and sessions, then reset credentials and re-register MFA.
-
POST /v1.0/users/{id}/revokeSignInSessions. - Temporarily disable the account if activity must be halted during investigation.
-
PATCH /v1.0/users/{id}with body{"accountEnabled": false}. - Remove other attacker persistence: attacker-registered MFA methods, malicious inbox/forwarding rules, and OAuth consents.
- Tighten device registration and join controls via Conditional Access (restrict who can register/join devices, require MFA for registration, and require a compliant/managed device for resource access).
Rule query
editsequence with maxspan=3m
[authentication where
data_stream.dataset == "azure.signinlogs" and
azure.signinlogs.category == "NonInteractiveUserSignInLogs" and
azure.signinlogs.properties.app_id == "29d9ed98-a469-4536-ade2-f981bc1d605e" and
azure.signinlogs.properties.resource_display_name == "Device Registration Service" and
azure.signinlogs.properties.incoming_token_type == "refreshToken" and
azure.signinlogs.properties.token_protection_status_details.sign_in_session_status == "unbound" and
azure.signinlogs.properties.user_type == "Member" and
azure.signinlogs.result_signature == "SUCCESS"
] by azure.signinlogs.properties.user_id
[any where
data_stream.dataset == "azure.auditlogs" and
azure.auditlogs.operation_name == "Register device" and
azure.auditlogs.properties.initiated_by.user.id != null and
azure.auditlogs.properties.target_resources.`0`.display_name like "DESKTOP-*" and
event.outcome == "success"
] by azure.auditlogs.properties.initiated_by.user.id
[authentication where
data_stream.dataset == "azure.signinlogs" and
azure.signinlogs.properties.incoming_token_type == "primaryRefreshToken" and
azure.signinlogs.properties.original_transfer_method == "deviceCodeFlow" and
azure.signinlogs.properties.is_interactive == true and
azure.signinlogs.properties.resource_display_name != "Device Registration Service" and
azure.signinlogs.properties.device_detail.is_managed != true and
azure.signinlogs.result_signature == "SUCCESS"
] by azure.signinlogs.properties.user_id
Framework: MITRE ATT&CKTM
-
Tactic:
- Name: Persistence
- ID: TA0003
- Reference URL: https://attack.mitre.org/tactics/TA0003/
-
Technique:
- Name: Valid Accounts
- ID: T1078
- Reference URL: https://attack.mitre.org/techniques/T1078/
-
Sub-technique:
- Name: Cloud Accounts
- ID: T1078.004
- Reference URL: https://attack.mitre.org/techniques/T1078/004/
-
Technique:
- Name: Account Manipulation
- ID: T1098
- Reference URL: https://attack.mitre.org/techniques/T1098/
-
Sub-technique:
- Name: Device Registration
- ID: T1098.005
- Reference URL: https://attack.mitre.org/techniques/T1098/005/
-
Tactic:
- Name: Defense Evasion
- ID: TA0005
- Reference URL: https://attack.mitre.org/tactics/TA0005/
-
Technique:
- Name: Use Alternate Authentication Material
- ID: T1550
- Reference URL: https://attack.mitre.org/techniques/T1550/
-
Sub-technique:
- Name: Application Access Token
- ID: T1550.001
- Reference URL: https://attack.mitre.org/techniques/T1550/001/
-
Tactic:
- Name: Credential Access
- ID: TA0006
- Reference URL: https://attack.mitre.org/tactics/TA0006/
-
Technique:
- Name: Steal Application Access Token
- ID: T1528
- Reference URL: https://attack.mitre.org/techniques/T1528/