Compromise Infrastructure: Domains
Adversaries may hijack domains and/or subdomains that can be used during targeting. Domain registration hijacking involves changing the registration of a domain name without the original registrant's permission. Adversaries may gain access to the registrant's email account, social engineer registrar help desks, exploit renewal gaps, or compromise cloud services that manage DNS (e.g., AWS Route53, Azure DNS). Subdomain hijacking occurs when DNS entries point to non-existent or deprovisioned resources, allowing an adversary to take control of the subdomain. Domain shadowing involves creating malicious subdomains under a compromised domain while keeping existing DNS records intact, allowing the malicious subdomains to go unnoticed for extended periods.
// Detection 1: Azure DNS Zone Record Modifications (potential domain shadowing or hijack setup)
AuditLogs
| where TimeGenerated > ago(24h)
| where OperationName has_any ("MICROSOFT.NETWORK/DNSZONES/", "Write DNS", "Delete DNS")
| where Result == "success"
| extend TargetResource = tostring(TargetResources[0].displayName)
| extend ModifiedBy = tostring(InitiatedBy.user.userPrincipalName)
| extend ClientIP = tostring(InitiatedBy.user.ipAddress)
| extend RecordType = tostring(TargetResources[0].type)
| project TimeGenerated, OperationName, TargetResource, ModifiedBy, ClientIP, RecordType, Result, CorrelationId
| sort by TimeGenerated desc
// Detection 2: Suspicious DNS resolution patterns suggesting domain shadowing (new subdomains resolving)
// Run separately against DNS event tables
union isfuzzy=true DnsEvents, ASimDnsActivityLogs
| where TimeGenerated > ago(24h)
| where SubType =~ "LookupQuery" or EventType =~ "Query"
| where Name has_any (".") and strlen(Name) > 20
// Flag queries to subdomains not seen in the prior 30 days
| join kind=leftanti (
union isfuzzy=true DnsEvents, ASimDnsActivityLogs
| where TimeGenerated between (ago(31d) .. ago(24h))
| summarize by Name
) on Name
| summarize QueryCount=count(), Clients=make_set(ClientIP, 20), FirstSeen=min(TimeGenerated) by Name, IPAddresses
| where QueryCount >= 3
| extend SubdomainDepth = array_length(split(Name, "."))
| where SubdomainDepth >= 4
| sort by QueryCount desc Data Sources
Required Tables
False Positives
- Legitimate infrastructure changes by DNS administrators adding new subdomains for new services or deployments
- CDN or cloud service onboarding that creates new CNAME records pointing to provider infrastructure
- Automated certificate validation records (ACME _acme-challenge TXT records) created by Let's Encrypt or similar CAs
- Marketing or business development activities registering new subdomains for campaigns, microsites, or partner portals
- Cloud migration projects that temporarily create new DNS records pointing to new infrastructure while decommissioning old ones
References (11)
- https://attack.mitre.org/techniques/T1584/001/
- https://krebsonsecurity.com/2019/02/a-deep-dive-on-the-recent-widespread-dns-hijacking-attacks/
- https://www.icann.org/en/ssac/registration-services/documents/sac-007-domain-name-hijacking-incidents-threats-risks-and-remediation-12-07-2005-en
- https://unit42.paloaltonetworks.com/domain-shadowing/
- https://docs.microsoft.com/en-us/azure/security/fundamentals/subdomain-takeover
- https://github.com/EdOverflow/can-i-take-over-xyz
- https://www.cisa.gov/news-events/alerts/2019/01/10/dns-infrastructure-tampering
- https://attack.mitre.org/tactics/TA0042/
- https://www.mandiant.com/resources/apt1-exposing-one-of-chinas-cyber-espionage-units
- https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/logging-using-cloudtrail.html
- https://learn.microsoft.com/en-us/azure/dns/dns-operations-dnszones-portal
Unlock Pro Content
Get the full detection package for T1584.001 including response playbook, investigation guide, and atomic red team tests.