Skip to content

Commit 37f0d91

Browse files
Merge pull request #224450 from TerryLanfear/sec-230119
Freshness update
2 parents 4519251 + dcd12ae commit 37f0d91

File tree

2 files changed

+29
-46
lines changed

2 files changed

+29
-46
lines changed

articles/security/fundamentals/subdomain-takeover.md

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
title: Prevent subdomain takeovers with Azure DNS alias records and Azure App Service's custom domain verification
44
description: Learn how to avoid the common high-severity threat of subdomain takeover
55
services: security
6-
author: memildin
6+
author: terrylanfear
77
manager: rkarlin
88

99
ms.assetid:
@@ -12,18 +12,17 @@ ms.subservice: security-fundamentals
1212
ms.topic: article
1313
ms.tgt_pltfrm: na
1414
ms.workload: na
15-
ms.date: 02/04/2021
16-
ms.author: memildin
15+
ms.date: 01/19/2023
16+
ms.author: terrylan
1717

1818
---
1919
# Prevent dangling DNS entries and avoid subdomain takeover
2020

2121
This article describes the common security threat of subdomain takeover and the steps you can take to mitigate against it.
2222

23-
2423
## What is a subdomain takeover?
2524

26-
Subdomain takeovers are a common, high-severity threat for organizations that regularly create, and delete many resources. A subdomain takeover can occur when you have a [DNS record](../../dns/dns-zones-records.md#dns-records) that points to a deprovisioned Azure resource. Such DNS records are also known as "dangling DNS" entries. CNAME records are especially vulnerable to this threat. Subdomain takeovers enable malicious actors to redirect traffic intended for an organizations domain to a site performing malicious activity.
25+
Subdomain takeovers are a common, high-severity threat for organizations that regularly create, and delete many resources. A subdomain takeover can occur when you have a [DNS record](../../dns/dns-zones-records.md#dns-records) that points to a deprovisioned Azure resource. Such DNS records are also known as "dangling DNS" entries. CNAME records are especially vulnerable to this threat. Subdomain takeovers enable malicious actors to redirect traffic intended for an organization's domain to a site performing malicious activity.
2726

2827
A common scenario for a subdomain takeover:
2928

@@ -35,29 +34,25 @@ A common scenario for a subdomain takeover:
3534

3635
1. **DEPROVISIONING:**
3736

38-
1. The Azure resource is deprovisioned or deleted after it is no longer needed.
39-
40-
At this point, the CNAME record `greatapp.contoso.com` *should* be removed from your DNS zone. If the CNAME record isn't removed, it's advertised as an active domain but doesn't route traffic to an active Azure resource. This is the definition of a dangling DNS record.
37+
1. The Azure resource is deprovisioned or deleted after it is no longer needed.
38+
39+
At this point, the CNAME record `greatapp.contoso.com` *should* be removed from your DNS zone. If the CNAME record isn't removed, it's advertised as an active domain but doesn't route traffic to an active Azure resource. This is the definition of a "dangling" DNS record.
4140

42-
1. The dangling subdomain, `greatapp.contoso.com`, is now vulnerable and can be taken over by being assigned to another Azure subscriptions resource.
41+
1. The dangling subdomain, `greatapp.contoso.com`, is now vulnerable and can be taken over by being assigned to another Azure subscription's resource.
4342

4443
1. **TAKEOVER:**
4544

4645
1. Using commonly available methods and tools, a threat actor discovers the dangling subdomain.
4746

4847
1. The threat actor provisions an Azure resource with the same FQDN of the resource you previously controlled. In this example, `app-contogreat-dev-001.azurewebsites.net`.
4948

50-
1. Traffic being sent to the subdomain `greatapp.contoso.com` is now routed to the malicious actor’s resource where they control the content.
51-
52-
49+
1. Traffic being sent to the subdomain `greatapp.contoso.com` is now routed to the malicious actor's resource where they control the content.
5350

5451
![Subdomain takeover from a deprovisioned website](./media/subdomain-takeover/subdomain-takeover.png)
5552

56-
57-
5853
## The risks of subdomain takeover
5954

60-
When a DNS record points to a resource that isn't available, the record itself should have been removed from your DNS zone. If it hasn't been deleted, it's a dangling DNS record and creates the possibility for subdomain takeover.
55+
When a DNS record points to a resource that isn't available, the record itself should have been removed from your DNS zone. If it hasn't been deleted, it's a "dangling DNS" record and creates the possibility for subdomain takeover.
6156

6257
Dangling DNS entries make it possible for threat actors to take control of the associated DNS name to host a malicious website or service. Malicious pages and services on an organization's subdomain might result in:
6358

@@ -69,8 +64,6 @@ Dangling DNS entries make it possible for threat actors to take control of the a
6964

7065
- **Further risks** - Malicious sites might be used to escalate into other classic attacks such as XSS, CSRF, CORS bypass, and more.
7166

72-
73-
7467
## Identify dangling DNS entries
7568

7669
To identify DNS entries within your organization that might be dangling, use Microsoft's GitHub-hosted PowerShell tools ["Get-DanglingDnsRecords"](https://aka.ms/DanglingDNSDomains).
@@ -94,20 +87,17 @@ The tool supports the Azure resources listed in the following table. The tool ex
9487
| Azure App Service | microsoft.web/sites | properties.defaultHostName | `abc.azurewebsites.net` |
9588
| Azure App Service - Slots | microsoft.web/sites/slots | properties.defaultHostName | `abc-def.azurewebsites.net` |
9689

97-
98-
9990
### Prerequisites
10091

10192
Run the query as a user who has:
10293

10394
- at least reader level access to the Azure subscriptions
10495
- read access to Azure resource graph
10596

106-
If you're a global administrator of your organization’s tenant, elevate your account to have access to all of your organization’s subscription using the guidance in [Elevate access to manage all Azure subscriptions and management groups](../../role-based-access-control/elevate-access-global-admin.md).
107-
97+
If you're a global administrator of your organization's tenant, elevate your account to have access to all of your organization's subscription using the guidance in [Elevate access to manage all Azure subscriptions and management groups](../../role-based-access-control/elevate-access-global-admin.md).
10898

10999
> [!TIP]
110-
> Azure Resource Graph has throttling and paging limits that you should consider if you have a large Azure environment.
100+
> Azure Resource Graph has throttling and paging limits that you should consider if you have a large Azure environment.
111101
>
112102
> [Learn more about working with large Azure resource data sets](../../governance/resource-graph/concepts/work-with-data.md).
113103
>
@@ -117,7 +107,7 @@ If you're a global administrator of your organization’s tenant, elevate your a
117107

118108
Learn more about the PowerShell script, **Get-DanglingDnsRecords.ps1**, and download it from GitHub: https://aka.ms/Get-DanglingDnsRecords.
119109

120-
## Remediate dangling DNS entries
110+
## Remediate dangling DNS entries
121111

122112
Review your DNS zones and identify CNAME records that are dangling or have been taken over. If subdomains are found to be dangling or have been taken over, remove the vulnerable subdomains and mitigate the risks with the following steps:
123113

@@ -127,28 +117,27 @@ Review your DNS zones and identify CNAME records that are dangling or have been
127117

128118
1. Review your application code for references to specific subdomains and update any incorrect or outdated subdomain references.
129119

130-
1. Investigate whether any compromise has occurred and take action per your organizations incident response procedures. Tips and best practices for investigating this issue can be found below.
120+
1. Investigate whether any compromise has occurred and take action per your organization's incident response procedures. Tips and best practices for investigating this issue can be found below.
131121

132122
If your application logic is such that secrets such as OAuth credentials were sent to the dangling subdomain, or privacy-sensitive information was sent to the dangling subdomains, that data might have been exposed to third-parties.
133123

134124
1. Understand why the CNAME record was not removed from your DNS zone when the resource was deprovisioned and take steps to ensure that DNS records are updated appropriately when Azure resources are deprovisioned in the future.
135125

136-
137126
## Prevent dangling DNS entries
138127

139128
Ensuring that your organization has implemented processes to prevent dangling DNS entries and the resulting subdomain takeovers is a crucial part of your security program.
140129

141-
Some Azure services offer features to aid in creating preventative measures and are detailed below. Other methods to prevent this issue must be established through your organizations best practices or standard operating procedures.
130+
Some Azure services offer features to aid in creating preventative measures and are detailed below. Other methods to prevent this issue must be established through your organization's best practices or standard operating procedures.
142131

143132
### Enable Microsoft Defender for App Service
144133

145-
Microsoft Defender for Cloud's integrated cloud workload protection platform (CWPP), Microsoft Defender for Cloud, offers a range of plans to protect your Azure, hybrid, and multi-cloud resources and workloads.
134+
Microsoft Defender for Cloud's integrated cloud workload protection platform (CWPP) offers a range of plans to protect your Azure, hybrid, and multicloud resources and workloads.
146135

147136
The **Microsoft Defender for App Service** plan includes dangling DNS detection. With this plan enabled, you'll get security alerts if you decommission an App Service website but don't remove its custom domain from your DNS registrar.
148137

149138
Microsoft Defender for Cloud's dangling DNS protection is available whether your domains are managed with Azure DNS or an external domain registrar and applies to App Service on both Windows and Linux.
150139

151-
Learn more about this and other benefits of this Microsoft Defender plans in [Introduction to Microsoft Defender for App Service](../../security-center/defender-for-app-service-introduction.md).
140+
Learn more about this and other benefits of this Microsoft Defender plans in [Introduction to Microsoft Defender for App Service](../../defender-for-cloud/defender-for-app-service-introduction.md).
152141

153142
### Use Azure DNS alias records
154143

@@ -163,18 +152,14 @@ Despite the limited service offerings today, we recommend using alias records to
163152

164153
[Learn more about the capabilities of Azure DNS's alias records](../../dns/dns-alias.md#capabilities).
165154

166-
167-
168155
### Use Azure App Service's custom domain verification
169156

170-
When creating DNS entries for Azure App Service, create an asuid.{subdomain} TXT record with the Domain Verification ID. When such a TXT record exists, no other Azure Subscription can validate the Custom Domain that is, take it over.
157+
When creating DNS entries for Azure App Service, create an asuid.{subdomain} TXT record with the Domain Verification ID. When such a TXT record exists, no other Azure Subscription can validate the Custom Domain that is, take it over.
171158

172159
These records don't prevent someone from creating the Azure App Service with the same name that's in your CNAME entry. Without the ability to prove ownership of the domain name, threat actors can't receive traffic or control the content.
173160

174161
[Learn more about how to map an existing custom DNS name to Azure App Service](../../app-service/app-service-web-tutorial-custom-domain.md).
175162

176-
177-
178163
### Build and automate processes to mitigate the threat
179164

180165
It's often up to developers and operations teams to run cleanup processes to avoid dangling DNS threats. The practices below will help ensure your organization avoids suffering from this threat.
@@ -196,33 +181,30 @@ It's often up to developers and operations teams to run cleanup processes to avo
196181

197182
- Maintain a service catalog of your Azure fully qualified domain name (FQDN) endpoints and the application owners. To build your service catalog, run the following Azure Resource Graph query script. This script projects the FQDN endpoint information of the resources you have access to and outputs them in a CSV file. If you have access to all the subscriptions for your tenant, the script considers all those subscriptions as shown in the following sample script. To limit the results to a specific set of subscriptions, edit the script as shown.
198183

199-
200184
- **Create procedures for remediation:**
201185
- When dangling DNS entries are found, your team needs to investigate whether any compromise has occurred.
202186
- Investigate why the address wasn't rerouted when the resource was decommissioned.
203187
- Delete the DNS record if it's no longer in use, or point it to the correct Azure resource (FQDN) owned by your organization.
204188

205-
206189
### Clean up DNS pointers or Re-claim the DNS
207190

208-
Upon deletion of the classic cloud service resource, the corresponding DNS is reserved for 7 days. During the reservation period, re-use of the DNS will be forbidden EXCEPT for subscriptions belonging to the AAD tenant of the subscription originally owning the DNS. After the reservation expires, the DNS is free to be claimed by any subscription. By taking DNS reservations, the customer is afforded some time to either 1) clean up any associations/pointers to said DNS or 2) re-claim the DNS in Azure. The DNS name being reserved can be derived by appending the cloud service name to the DNS zone for that cloud.
191+
Upon deletion of the classic cloud service resource, the corresponding DNS is reserved for 7 days. During the reservation period, re-use of the DNS will be forbidden EXCEPT for subscriptions belonging to the Azure AD tenant of the subscription originally owning the DNS. After the reservation expires, the DNS is free to be claimed by any subscription. By taking DNS reservations, the customer is afforded some time to either 1) clean up any associations/pointers to said DNS or 2) re-claim the DNS in Azure. The DNS name being reserved can be derived by appending the cloud service name to the DNS zone for that cloud.
209192

210-
Public - cloudapp.net
211-
Mooncake - chinacloudapp.cn
212-
Fairfax - usgovcloudapp.net
213-
BlackForest - azurecloudapp.de
193+
- Public - cloudapp.net
194+
- Mooncake - chinacloudapp.cn
195+
- Fairfax - usgovcloudapp.net
196+
- BlackForest - azurecloudapp.de
214197

215-
i.e. a hosted service in Public named test would have DNS test.cloudapp.net
198+
For example, a hosted service in Public named "test" would have DNS "test.cloudapp.net"
216199

217200
Example:
218-
Subscription ‘A’ and subscription ‘B’ are the only subscriptions belonging to AAD tenant ‘AB’. Subscription ‘A’ contains a classic cloud service ‘test’ with DNS name ‘test.cloudapp.net’. Upon deletion of the cloud service, a reservation is taken on DNS name ‘test.cloudapp.net’. During the 7 day reservation period, only subscription ‘A’ or subscription ‘B’ will be able to claim the DNS name ‘test.cloudapp.net’ by creating a classic cloud service named ‘test’. No other subscriptions will be allowed to claim it. After the 7 days is up, any subscription in Azure can now claim ‘test.cloudapp.net’.
219-
201+
Subscription 'A' and subscription 'B' are the only subscriptions belonging to Azure AD tenant 'AB'. Subscription 'A' contains a classic cloud service 'test' with DNS name 'test.cloudapp.net'. Upon deletion of the cloud service, a reservation is taken on DNS name 'test.cloudapp.net'. During the 7 day reservation period, only subscription 'A' or subscription 'B' will be able to claim the DNS name 'test.cloudapp.net' by creating a classic cloud service named 'test'. No other subscriptions will be allowed to claim it. After the 7 days are up, any subscription in Azure can now claim 'test.cloudapp.net'.
220202

221203
## Next steps
222204

223205
To learn more about related services and Azure features you can use to defend against subdomain takeover, see the following pages.
224206

225-
- [Enable Microsoft Defender for App Service](../../security-center/defender-for-app-service-introduction.md) - to receive alerts when dangling DNS entries are detected
207+
- [Enable Microsoft Defender for App Service](../../defender-for-cloud/enable-enhanced-security.md) - to receive alerts when dangling DNS entries are detected
226208

227209
- [Prevent dangling DNS records with Azure DNS](../../dns/dns-alias.md#prevent-dangling-dns-records)
228210

articles/virtual-machines/extensions/iaas-antimalware-windows.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ services: virtual-machines
55
documentationcenter: ''
66
author: TerryLanfear
77
manager: rkarlin
8-
editor: ''
8+
99
ms.assetid:
1010
ms.service: virtual-machines
1111
ms.subservice: extensions
1212
ms.collection: windows
1313
ms.topic: article
1414
ms.tgt_pltfrm: vm-windows
1515
ms.workload: infrastructure-services
16-
ms.date: 07/30/2021
16+
ms.date: 01/19/2023
1717
ms.author: terrylan
1818

1919
---
@@ -132,6 +132,7 @@ Depends on your type of deployment, use the corresponding commands to deploy the
132132
* [Azure Resource Manager based Virtual Machine](../../security/fundamentals/antimalware-code-samples.md#enable-and-configure-microsoft-antimalware-for-azure-resource-manager-vms)
133133
* [Azure Service Fabric Clusters](../../security/fundamentals/antimalware-code-samples.md#add-microsoft-antimalware-to-azure-service-fabric-clusters)
134134
* [Classic Cloud Service](/powershell/module/servicemanagement/azure.service/set-azureserviceextension)
135+
* [Azure Arc-enabled servers](../../security/fundamentals/antimalware-code-samples.md#add-microsoft-antimalware-for-azure-arc-enabled-servers)
135136

136137
## Troubleshoot and support
137138

0 commit comments

Comments
 (0)