Entra ID Device Registration with Default Hostname Pattern
editEntra ID Device Registration with Default Hostname Pattern
editDetects a successful Microsoft Entra ID audit event for Register device where the registered device carries a default Windows or kit-style hostname (DESKTOP-, Device-, or Work Pc*). Adversary-in-the-middle and device-code phishing kits, along with tooling such as ROADtools, register a device with the token broker to obtain a device-bound Primary Refresh Token (PRT) and rarely set a custom device name, so the registered object keeps the default DESKTOP-<random>, Device-<random>, or Work Pc <random> name. Registering a device establishes persistence that survives password resets and user session revocation. This rule is intentionally simple and user-agent and OS-build independent, so it still fires when a kit changes its Dsreg user agent or spoofed OS build. Default hostnames are also common on legitimate personal or freshly imaged Windows devices, so this is a building block rule that does not generate alerts on its own. It captures the population of default-named registrations so it can be correlated with other signals (non-Dsreg user agents, spoofed OS builds, multiple registrations, or the AiTM chain) and baselined over time, with the intent to promote it to a standalone rule if the volume proves manageable.
Rule type: query
Rule indices:
- logs-azure.auditlogs-*
Severity: low
Risk score: 21
Runs every: 5m
Searches indices from: now-9m (Date Math format, see also Additional look-back time)
Maximum alerts per execution: 100
References:
- https://www.huntress.com/blog/token-replay-spray
- https://www.elastic.co/security-labs/tycoon-2fa-aitm-detection-engineering
- https://github.com/dirkjanm/ROADtools
- https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/
- https://learn.microsoft.com/en-us/entra/identity/devices/concept-primary-refresh-token
Tags:
- Domain: Cloud
- Domain: Identity
- Platform: Entra ID
- Platform: Azure
- Data Source: Entra ID Audit Logs
- Use Case: Threat Detection
- Tactic: Persistence
- Resources: Investigation Guide
- Rule Type: BBR
- Rule Type: Custom Query (KQL)
- Threat: AiTM Phishing
Version: 1
Rule authors:
- Elastic
Rule license: Elastic License v2
Investigation guide
editTriage and analysis
Investigating Entra ID Device Registration with Default Hostname Pattern
This rule fires on a successful Register device audit event where the target device name starts with DESKTOP-, Device-, or Work Pc. Huntress reported all three prefixes, each followed by a random suffix, in the token replay campaign.
Phishing kits and tooling that register a device to mint a PRT usually leave the default name in place. The signal is
weak alone and strong in context, so triage on who registered it, from where, and what happened before and after.
Possible investigation steps
-
Identify the user (
azure.auditlogs.properties.initiated_by.user.userPrincipalName), the device name and object ID (azure.auditlogs.properties.target_resources.0.display_name,azure.auditlogs.properties.target_resources.0.id), and the registration source (azure.auditlogs.properties.initiated_by.user.ipAddress). -
Review
azure.auditlogs.properties.userAgent. SpoofedDsreg/10.0 (Windows 10.0.19041.928)orDsreg/10.0 (Windows 10.0.19045.2006)strings, or raw HTTP clients such asaxios/*,node, orpython-requests/*, indicate tooling. -
Pivot to
logs-azure.signinlogs-*for the same user shortly before the registration. Look for a Microsoft Authentication Broker (29d9ed98-a469-4536-ade2-f981bc1d605e) sign-in to theDevice Registration Serviceresource (01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9), risky or AiTM sign-ins, and device-code flows. -
Pivot after the registration for
primaryRefreshTokensign-ins to other resources from an unmanaged device, from the same source IP or a hosting ASN. -
Check the registration source ASN (
source.as.organization.name). Hosting, cloud, or VPS providers (for example Hetzner, AWS, Alibaba, Tencent, Interserver) are far more suspicious than the user’s usual ISP or corporate egress. There is no hosting flag in the log, so judge by organization name. -
Aggregate
Register deviceevents by source IP and ASN across the tenant. One IP registering devices for several users is high-fidelity suspicious. -
Check for added persistence in the same window:
User registered security info,User deleted security info, new inbox rules, or OAuth consents.
False positive analysis
- Legitimate users enrolling a personal or newly imaged Windows device often keep the default hostname. Validate with the user and the source network.
- Approved imaging or provisioning workflows. Add exceptions by initiating account or egress IP.
- Consider pairing with the related Entra ID device-registration rules (user agent, OS build, multiple registrations, and the AiTM chain rule) to raise confidence.
Response and remediation
-
If suspicious, remove the rogue device BEFORE revoking sessions, because device-bound PRTs survive
revokeSignInSessions. -
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. - Review and remove attacker-added MFA methods, inbox or forwarding rules, and OAuth consents.
- Restrict who can register or join devices and require MFA or a compliant device for registration through Conditional Access.
Rule query
editdata_stream.dataset:"azure.auditlogs" and event.action:"Register device" and event.outcome:(success or Success) and azure.auditlogs.properties.initiated_by.user.id:* and azure.auditlogs.properties.target_resources.0.display_name:(DESKTOP-* or Device-* or Work*Pc*)
Framework: MITRE ATT&CKTM
-
Tactic:
- Name: Persistence
- ID: TA0003
- Reference URL: https://attack.mitre.org/tactics/TA0003/
-
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/