Skip to content
Misconfiguration Write-up Advanced

Weaponizing DHCP DNS Spoofing — A Hands-On Guide

The DHCP DNS Dynamic Updates feature in Microsoft DHCP servers can be abused by an unauthenticated attacker to create or overwrite DNS records in Active Directory Integrated DNS zones, pointing them to an attacker-controlled machine. This allows traffic redirection, interception of authentication, and blocking of security services.

Ori David Follow

Published on akamai.com

In the first part of this blog series we introduced a new set of attacks against Active Directory domains that use Microsoft Dynamic Host Configuration Protocol (DHCP) servers. These attacks enable threat actors to spoof DNS records in Active Directory Integrated DNS (ADIDNS) zones by abusing the DHCP DNS Dynamic…

Ori David (@oridavid123), on akamai.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

Context

This is the second post in a series about attacking Active Directory domains that use Microsoft DHCP servers. The feature at the centre is DHCP DNS Dynamic Updates: when a client leases an address, the DHCP server can register a DNS record for it in an Active Directory Integrated DNS (ADIDNS) zone. The first post covered the theory and the misconfigurations; this one covers the practical details needed to exploit them, the limitations, a DHCP server behaviour that lets you register several records pointing at the same address, and a Python tool, DDSpoof, that automates the work.

A DHCP server can only create records inside its own associated ADI zone. A server associated with the aka.test domain can only write records with the suffix <hostname>.aka.test, so knowing that suffix tells you which records are spoofable through a given server.

We combined all the capabilities and techniques that we described in this blog series to create DDSpoof — a toolkit that enables the performance of DHCP DNS attacks.
We combined all the capabilities and techniques that we described in this blog series to create DDSpoof — a toolkit that enables the performance of DHCP DNS attacks. From the original on akamai.com

Setup

The researcher works from a Kali Linux machine inside the target network, with no domain credentials. The main client-side tool is the Linux dhclient utility, configured through /etc/dhcp/dhclient.conf. Running dhclient normally applies the leased configuration to the machine and overrides its current IP address; to avoid that, it is run on a virtual interface:

Bash
  dhclient <interface_name>:<virtual_interface_name>

After this, the original address ([redacted] in the example) stays in place while the virtual interface receives a new address from the DHCP server.

After running this command, we can see that our original IP address (172.25.14.55) remains unchanged, while our virtual interface received a new IP address from the DHCP server (Figure 1).
After running this command, we can see that our original IP address (172.25.14.55) remains unchanged, while our virtual interface received a new IP address from the DHCP server (Figure 1). From the original on akamai.com

Finding it

The reconnaissance is not a bug in itself: discovering DHCP servers and learning their configuration is part of the protocol, which is what makes the attack surface easy to reach from an unauthenticated position. The interesting part is the combination of what can be learned this way and a lease-deletion behaviour that leaves DNS records behind.

Identifying DHCP servers

Send a DHCP Discover broadcast and inspect the Offer responses. Recording the traffic and looking at the Offer messages reveals every active DHCP server in the network.

If we record the traffic and inspect DHCP Offer messages, we will be able to identify all active DHCP servers (Figure 2).
If we record the traffic and inspect DHCP Offer messages, we will be able to identify all active DHCP servers (Figure 2). From the original on akamai.com

Obtaining the domain and DNS server

The Parameter Request List option lets a client ask the server for specific settings. Requesting the Domain Name and Domain Name Server options gives both the suffix used for records and the DNS server that will host them, which is what you need to query later and verify success. Add this line to the dhclient config file:

Bash
  request domain-name, domain-name-servers;

Running dhclient on a virtual interface and inspecting the Discover message shows the Parameter Request List option carrying the requested fields.

When we run dhclient (as before, on a virtual interface) and inspect our Discover message, we see that it includes the Parameter Request List option with the fields we requested (Figure 3).
When we run dhclient (as before, on a virtual interface) and inspect our Discover message, we see that it includes the Parameter Request List option with the fields we requested (Figure 3). From the original on akamai.com

A listening Microsoft DHCP server answers with an Offer containing the requested parameters.

A listening Microsoft DHCP server should send an Offer response to this Discover message with the requested parameters (Figure 4).
A listening Microsoft DHCP server should send an Offer response to this Discover message with the requested parameters (Figure 4). From the original on akamai.com

Deducing Name Protection status

Name Protection decides whether certain overwrite attacks are possible. Its status cannot be queried directly, but it can be deduced in four steps:

  1. Create a DNS record using a DHCP DNS Dynamic Update.
  2. Verify that an A record was created.
  3. Query the DNS server for a DHCID record with the same name.
  4. If a DHCID record is present alongside the A record, Name Protection is enabled.

To trigger the update with dhclient, add these lines to the config file:

Bash
  send fqdn.fqdn = “kali.aka.test”;
  send fqdn.server-update on;
  send dhcp-server-identifier [redacted];

The first two lines add the FQDN option with the Server flag, which is what makes the DHCP server register the record on the client's behalf. The third line is optional and adds a Server Identifier option so a specific DHCP server can be targeted when several are present.

After running dhclient, query the target DNS server with nslookup and look for a DHCID record. In the example a DHCID record was created, which indicates Name Protection is enabled.

After running dhclient, we can use nslookup to query the target DNS server and look for a DHCID record (Figure 5).
After running dhclient, we can use nslookup to query the target DNS server and look for a DHCID record (Figure 5). From the original on akamai.com

Deducing the Dynamic Update configuration

Three settings decide when the server creates DNS records for clients:

  • Dynamically update only if requested by the client. The default. A record is created only if the request contains the FQDN option and the server flag is set.
  • Always dynamically update. A record is created for any request with the FQDN option, regardless of the server flag.
  • Dynamically update for clients that do not request updates. A record is created even without the FQDN option, using the Hostname option to build the FQDN. This exists to support old clients that do not use the FQDN option.
There are three options that determine in which cases the DHCP server will create DNS records for clients (Figure 6).
There are three options that determine in which cases the DHCP server will create DNS records for clients (Figure 6). From the original on akamai.com

Knowing the setting lets an attacker sniff DHCP requests and spot the ones that lead to a managed record, which are the candidates for a managed record overwrite. The setting is deduced from side effects: trigger an update under each condition and query DNS to see whether a record appeared. The dhclient configuration for each test is:

Bash
  # Only include the hostname option, without the FQDN option
  send host-name = “test.aka.test”;
  send dhcp-server-identifier [redacted];
Bash
  # Include the FQDN option, without the server update flag
  send fqdn.fqdn = “test.aka.test”;
  send dhcp-server-identifier [redacted];
Bash
  # Include the FQDN option and the server update flag
  send fqdn.fqdn = “test.aka.test”;
  send fqdn.server-update on;
  send dhcp-server-identifier [redacted];

Exploitation

Step 1: Work within the address limitations

The spoofed records must point at a machine you control, but the address cannot be arbitrary. The DHCP server has a defined scope of internal addresses and refuses to lease, and therefore to register, anything outside it. Two limits follow:

  • The address cannot be outside the network, because you cannot lease an external address.
  • The address cannot belong to a machine with a static IP, because such an address is unlikely to be in the lease pool.

Since you have an internal machine that can take a dynamic address, use whatever the DHCP server offers. To keep using the same address for later actions, request it explicitly with the Requested IP Address option:

Bash
  send dhcp-requested-address [redacted];

Step 2: Free the address without losing the record

Spoofing several records means pointing them all at the same address, but once an address is leased it cannot be leased to another client, which prevents IP conflicts. After a lease is used for a spoof, the address leaves the pool, and asking for it again with a different FQDN gets you a different address.

If we try to lease the same IP address again with a different FQDN, the server offers a different address (Figure 7).
If we try to lease the same IP address again with a different FQDN, the server offers a different address (Figure 7). From the original on akamai.com

Releasing the lease does not help: the release triggers a DNS Dynamic Update that deletes the record just released, removing the spoofed record.

We can't solve this problem by releasing the previous lease, because this would trigger a DNS Dynamic Update by the DHCP server to delete the record that was just released — and would remove our previously spoofed record (Figure 8).
We can't solve this problem by releasing the previous lease, because this would trigger a DNS Dynamic Update by the DHCP server to delete the record that was just released — and would remove our previously spoofed record (Figure 8). From the original on akamai.com

The goal is therefore to free the address, returning it to the pool, while keeping the existing spoofed record. The researcher found a behaviour that does both. Send a DHCP Request to the server currently leasing the address with:

  • the Client MAC address that was used to obtain the existing lease;
  • the Server Identifier of a server different from the targeted one.

On seeing this broadcast, the targeted server assumes the client is asking another server for a new address and no longer needs the existing one. It deletes the lease without deleting the associated DNS record. Why the record survives is not clear; the researcher suspects a logical bug.

It will then delete the IP lease without deleting the associated DNS record (Figure 9).
It will then delete the IP lease without deleting the associated DNS record (Figure 9). From the original on akamai.com

Step 3: Register two records on one address

Create the first record with dhclient as described earlier. The record appears and the lease is visible in the DHCP server lease table.

Our record is created, and if we look at the DHCP server lease table we can see our lease is present there (Figure 10).
Our record is created, and if we look at the DHCP server lease table we can see our lease is present there (Figure 10). From the original on akamai.com

Then change the dhcp-server-identifier option in the config file to any other IP, run dhclient again, and the lease is deleted. Run dhclient once more with a different FQDN while requesting the same address, and a second record is created.

We can now simply run dhclient again with a different FQDN while requesting the same IP address and create a second record (Figure 11).
We can now simply run dhclient again with a different FQDN while requesting the same IP address and create a second record (Figure 11). From the original on akamai.com

Step 4: Enumerate with DDSpoof

DDSpoof is a Python tool that performs DHCP server enumeration, runs custom DHCP DNS commands and identifies spoofing targets. Run it against the network, specifying the interface used to send and receive packets.

We will first run DDSpoof to scan the network and identify potential targets (specifying which interface to use for sending and receiving packets; Figure 12).
We will first run DDSpoof to scan the network and identify potential targets (specifying which interface to use for sending and receiving packets; Figure 12). From the original on akamai.com

It identifies all reachable DHCP servers and their configurations, determines Name Protection status, and checks whether your current address is available for lease on the target server. In the example the address is not available, so it is manually changed to one the server offers.

In this example, our IP address is not available for lease on our target server, so we manually modify it to the one offered by the server (Figure 13).
In this example, our IP address is not available for lease on our target server, so we manually modify it to the one offered by the server (Figure 13). From the original on akamai.com

Step 5: DHCP DNS spoofing

To find failed name resolutions and register records for them, use the start-llmnr command. It starts an LLMNR sniffer that reports LLMNR queries in the network, pointing at potential targets.

This command starts an LLMNR sniffer that will notify us about LLMNR queries in the network, which could lead us toward potential spoofing targets (Figure 14).
This command starts an LLMNR sniffer that will notify us about LLMNR queries in the network, which could lead us toward potential spoofing targets (Figure 14). From the original on akamai.com

In the example the sniffer identifies files.aka.test. The write-record command then attempts to register that name.

Now, we can use the write-record command to attempt to register this DNS name (Figure 15).
Now, we can use the write-record command to attempt to register this DNS name (Figure 15). From the original on akamai.com

DDSpoof creates the record pointing at the attacker's address, confirmed with nslookup.

As we can see, DDSpoof successfully creates this DNS record, pointing to our IP address! We can verify this with nslookup (Figure 16).
As we can see, DDSpoof successfully creates this DNS record, pointing to our IP address! We can verify this with nslookup (Figure 16). From the original on akamai.com

From then on, any host resolving files.aka.test is directed to the controlled machine. When the attack is over, the delete-record command removes the spoofed record.

When we are done with our attack, we can use the delete-record command to remove our spoofed record (Figure 17).
When we are done with our attack, we can use the delete-record command to remove our spoofed record (Figure 17). From the original on akamai.com

Step 6: DHCP DNS overwrite

If the target DHCP server is also a DNS server, it may also be a Domain Controller, since DNS is often installed on a DC in Active Directory environments. This is checked with nmap:

Bash
  Nmap -p389 -sV 172.25.14.123
The results confirm our suspicions (Figure 18).
The results confirm our suspicions (Figure 18). From the original on akamai.com

If no DNS credential is configured, any record in the ADI zone can be overwritten. In the example a host named file-server.aka.test is identified.

Let's say we identified a host named file-server.aka.test (Figure 19).
Let's say we identified a host named file-server.aka.test (Figure 19). From the original on akamai.com

The write-record command attempts the overwrite. A weak DNS credential would make this fail; here none was configured, so the overwrite succeeded.

We can verify that the overwrite was successful by using nslookup again (Figure 21).
We can verify that the overwrite was successful by using nslookup again (Figure 21). From the original on akamai.com
We can verify that the overwrite was successful by using nslookup again (Figure 21).
We can verify that the overwrite was successful by using nslookup again (Figure 21).

Step 7: Bypassing Name Protection

The start-dhcp command sniffs DHCP traffic and identifies DHCP Request messages.

In another scenario, we run the start-dhcp DDSpoof command that sniffs DHCP traffic, identifying DHCP Request messages (Figure 22).
In another scenario, we run the start-dhcp DDSpoof command that sniffs DHCP traffic, identifying DHCP Request messages (Figure 22). From the original on akamai.com

In the example a machine named ubuntu-server.aka.test sends a request containing its FQDN, which may lead the server to create a record for it. That is an opportunity for a managed record overwrite, since managed records are created for non-Windows hosts that are not part of the domain and cannot talk to the DNS server directly. The obstacle is that this server has Name Protection enabled.

Our target DHCP server has enabled Name Protection (Figure 23).
Our target DHCP server has enabled Name Protection (Figure 23). From the original on akamai.com

Querying all records for ubuntu-server.aka.test shows a DHCID record is present.

If we query all the DNS records for our target ubuntu-server.aka.test, we see that a DHCID record is indeed present (Figure 24).
If we query all the DNS records for our target ubuntu-server.aka.test, we see that a DHCID record is indeed present (Figure 24). From the original on akamai.com

Name Protection is bypassed by sending a DHCP Release with a Client ID (CID), essentially the client MAC address, matching the original record owner, which makes the server delete the record. The set-cid command is given the target CID obtained earlier, so DDSpoof impersonates the original client. The delete-record command then removes the target record.

After this, we can run the delete-record command to remove our target record (Figure 25).
After this, we can run the delete-record command to remove our target record (Figure 25). From the original on akamai.com

Finally, write-record registers the name for the attacker.

Root cause

The attack surface is the DHCP DNS Dynamic Update feature itself: a server that registers records on behalf of unauthenticated clients will register names an attacker chooses, as long as the request carries the right options. The specific behaviour that makes multi-record spoofing practical is the lease deletion described above: a Request carrying the original client MAC and a foreign Server Identifier causes the server to drop the lease but leave the DNS record in place. The researcher suspects this is a logical bug. Name Protection, the control meant to stop overwrites, is bypassed because the Release is accepted with a spoofed CID matching the legitimate owner.

Impact

From an unauthenticated context, an attacker can spoof various DNS records in Active Directory domains. The report lists examples: targeting Windows machines to intercept NTLM or Kerberos authentication for relay or brute-force attacks; targeting applications that use insecure protocols to intercept sensitive data; and targeting records of internal security servers such as antivirus or SIEM to block access to them. The report calls these a few examples among many. The tool alone is not enough to cause damage: it needs network access and further exploitation to abuse the DNS spoofing primitive. Microsoft responded that the reported problems are either by design or not severe enough to receive a fix, so the surface is likely to remain.

Fix

No fix was applied: Microsoft does not plan to address the issue. The report instead points security teams at two tools to identify and mitigate the risk: Invoke-DHCPCheckup, to identify DHCP and DNS configurations in Active Directory, and DDSpoof, to highlight risks and test resilience to the DHCP DNS Dynamic Update attack surface.

Variants to test

  • Parameter Request List enumeration. Add request domain-name, domain-name-servers; to the client config and inspect the Offer. A positive result is an Offer carrying the zone suffix and DNS server, which tells you which records are spoofable through that server.
  • Name Protection deduction. Trigger an update with the FQDN option and Server flag, then query for a DHCID record. A DHCID alongside the A record means Name Protection is on.
  • Dynamic Update setting deduction. Run the three configurations above and check DNS after each. A record appearing without the FQDN option indicates the third setting; one appearing without the Server flag indicates the second; one appearing only with both indicates the default.
  • Lease deletion without record deletion. Lease an address, then send a Request with the original MAC and a foreign Server Identifier. A positive result is the lease gone from the lease table while the DNS record still resolves.
  • Overwrite without a DNS credential. Identify a host record and attempt write-record. Success means no DNS credential is configured.
  • Name Protection bypass. Sniff a DHCP Request to obtain the target CID, send a Release with set-cid, then delete-record and write-record. Success means the protected name can be taken over.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 21 min read.

What happened, in plain words

A security researcher, Ori David, published a hands-on guide showing how an attacker who is already sitting somewhere on a company network, but who has no username, no password and no account of any kind, can quietly take over the names that computers use to find each other. The trick relies on a feature of Microsoft DHCP servers: when a device asks the network for an address, the server that hands out addresses can also create a name entry for it in the company's internal phone book (DNS). That phone book is what turns a friendly name like files.aka.test into the numeric address of a machine.

If the server will create name entries on behalf of anyone who asks, then an attacker can ask it to create entries that point at the attacker's own machine. From then on, colleagues who type the friendly name are sent to the attacker instead of the real server. The researcher walks through how to find the address server, how to learn its settings, how to work around the limits, how to register several names at once, and how to take over names that already exist, even when a protection feature is switched on. Everything is packaged into a free Python tool called DDSpoof.

Microsoft was told about all of this and replied that the behaviours are either by design or not serious enough to fix, so the guide is aimed at defenders who want to test their own networks.

We combined all the capabilities and techniques that we described in this blog series to create DDSpoof — a toolkit that enables the performance of DHCP DNS attacks.
We combined all the capabilities and techniques that we described in this blog series to create DDSpoof — a toolkit that enables the performance of DHCP DNS attacks. From the original on akamai.com

The background you need first

Before the steps make sense, a few everyday ideas.

What an IP address is. Every device on a network has a number, like a postal address. In the examples here the numbers look like [redacted]. Computers find each other by these numbers.

What DNS is. Humans are bad at remembering numbers, so networks keep a phone book called DNS (Domain Name System). You ask for a name such as files.aka.test and DNS answers with the number. If an attacker can edit that phone book, they can make a name point at their own machine. That is called DNS spoofing, and it is the goal of everything in this guide.

What DHCP is. When you join a network, something has to hand your device an address, a gateway and a few other settings. That something is DHCP (Dynamic Host Configuration Protocol). A DHCP server keeps a pool of free addresses and leases one to each device for a while. The conversation is simple: the device shouts "any servers out there?" (a Discover message), servers answer "I can give you this address" (an Offer), the device picks one and asks for it formally (a Request), and the server confirms (an Ack).

What Active Directory and ADIDNS are. Active Directory is Microsoft's system for managing users and computers in a company. Its DNS records live inside Active Directory itself, in what is called an Active Directory Integrated DNS zone, or ADIDNS. A zone is simply a domain suffix, such as aka.test, and every record inside it ends with that suffix.

What DHCP DNS Dynamic Updates are. This is the feature at the centre of the guide. When a device leases an address, the DHCP server can offer to also create the DNS record for it, so that the device's name resolves without anyone typing it in by hand. Convenient, and also the attack surface: if the server will create records for anyone, it will create them for an attacker too.

What a lease is. The address the server hands out is not given away forever; it is leased, like a library book. The server notes in a lease table who has which address. While a lease is active, that address cannot be given to anyone else, which prevents two machines ending up with the same number.

What an FQDN is. A fully qualified domain name is the complete name of a machine, including the domain, for example kali.aka.test. The DHCP protocol has an option for the client to send its FQDN, and a flag telling the server "please register this for me".

What Name Protection is. A Microsoft DHCP setting that is meant to stop exactly this kind of abuse. When it is on, the server also creates a second, special record called a DHCID next to the normal address record (an A record). The DHCID acts like a claim ticket tied to the client that registered the name.

What LLMNR is. A fallback name lookup that Windows uses when normal DNS fails. A machine that cannot resolve a name will shout the name onto the local network asking "does anyone know this?". An attacker listening can hear those shouts and learn which names are worth stealing.

What NTLM and Kerberos are. The two main ways Windows machines prove who they are to each other. If you can redirect a machine to your own server when it tries to authenticate, you can capture the authentication attempt and try to reuse or crack it.

What a Domain Controller is. The central server in an Active Directory network. It handles logins and usually also runs DNS, which is why a machine that answers DNS queries is often also a Domain Controller.

What a virtual interface is. A pretend network card created in software on top of the real one. It lets you ask the network for a second address without disturbing the one your machine is already using.

What a sniffer is. A program that listens to network traffic passing by and reports what it sees.

What nmap is. A free tool that probes a machine's network ports to guess what services it runs. A port is like a numbered door on a machine; port 389 is the door used by LDAP, the directory service that Domain Controllers speak.

What a Python tool is. A program written in the Python language. You run it from a command line, give it commands, and it does the network work for you.

The setup

The researcher works from a Kali Linux machine placed inside the target network, with no domain credentials at all. Kali is a Linux distribution that ships with security tools. The main tool used by hand is dhclient, the standard Linux program for talking to DHCP servers. It reads its settings from a configuration file at /etc/dhcp/dhclient.conf.

There is a catch. If you just run dhclient, it takes the address the server offers and applies it to your machine, replacing the address you already had. That would cut you off from your own session. The workaround is to run it on a virtual interface, using this syntax:

Bash
  dhclient <interface_name>:<virtual_interface_name>

Line by line: dhclient is the program being run. <interface_name> is the real network card, for example eth0. The colon separates it from <virtual_interface_name>, a made-up label for the pretend card, for example eth0:1. The angle brackets are placeholders, not literal characters. The effect is that the new address lands on the virtual card while the real card keeps its own address.

After running this, the researcher's original address, [redacted], is still in place, and the virtual interface has received a fresh address from the DHCP server.

After running this command, we can see that our original IP address (172.25.14.55) remains unchanged, while our virtual interface received a new IP address from the DHCP server (Figure 1).
After running this command, we can see that our original IP address (172.25.14.55) remains unchanged, while our virtual interface received a new IP address from the DHCP server (Figure 1). From the original on akamai.com

Step 1: Find the DHCP servers

The first thing an attacker needs is a target: a DHCP server. Discovering servers and reading their settings is not a flaw in itself; it is simply part of how DHCP works, which is exactly why this attack surface is so easy to reach without any credentials.

The method is to send a DHCP Discover broadcast, which is a message shouted to the whole local network, and then look at the Offer replies that come back. Each reply comes from one server. Record the traffic and inspect the Offer messages, and you have a list of every active DHCP server on the network.

If we record the traffic and inspect DHCP Offer messages, we will be able to identify all active DHCP servers (Figure 2).
If we record the traffic and inspect DHCP Offer messages, we will be able to identify all active DHCP servers (Figure 2). From the original on akamai.com

Step 2: Learn the domain and the DNS server

Knowing a server exists is not enough. A DHCP server can only create records inside its own zone. A server tied to the aka.test domain can only write names ending in .aka.test. So the attacker needs to learn that suffix, and also which DNS server will hold the new records, so the results can be checked later.

The DHCP protocol has an option called the Parameter Request List, which is simply a list of settings the client would like the server to include in its reply. Two of those settings are the Domain Name (the suffix) and the Domain Name Server (the DNS server's address). To ask for them, add this line to the dhclient configuration file:

Bash
  request domain-name, domain-name-servers;

Line by line: request is the keyword that builds the Parameter Request List. domain-name asks for the zone suffix. The comma separates the two items. domain-name-servers asks for the DNS server address. The semicolon ends the statement, as in most configuration files of this kind.

Run dhclient on a virtual interface as before, then look at the Discover message it sent. It now carries the Parameter Request List option with those two fields inside.

When we run dhclient (as before, on a virtual interface) and inspect our Discover message, we see that it includes the Parameter Request List option with the fields we requested (Figure 3).
When we run dhclient (as before, on a virtual interface) and inspect our Discover message, we see that it includes the Parameter Request List option with the fields we requested (Figure 3). From the original on akamai.com

A Microsoft DHCP server that is listening will answer with an Offer that includes the requested settings.

A listening Microsoft DHCP server should send an Offer response to this Discover message with the requested parameters (Figure 4).
A listening Microsoft DHCP server should send an Offer response to this Discover message with the requested parameters (Figure 4). From the original on akamai.com

Step 3: Work out whether Name Protection is on

Name Protection decides whether the later overwrite attacks will work. The attacker cannot simply ask the server whether it is enabled, so the guide uses a four-step deduction:

  1. Create a DNS record using a DHCP DNS Dynamic Update.
  2. Check that an A record (the normal name-to-address record) was created.
  3. Ask the DNS server whether a DHCID record with the same name exists.
  4. If a DHCID record sits next to the A record, Name Protection is enabled.

The reasoning is that the DHCID is the claim ticket Name Protection adds. No ticket, no protection.

To make dhclient trigger the update, add these lines to the configuration file:

Bash
  send fqdn.fqdn = “kali.aka.test”;
  send fqdn.server-update on;
  send dhcp-server-identifier [redacted];

Line by line: the first line tells the client to send the FQDN option with the value kali.aka.test, which is the name to register. The second line sets the Server flag inside that option, which is the part that says "server, please do the registration for me". The third line is optional: it adds a Server Identifier option naming a specific DHCP server, [redacted], so that when several servers are present, only that one is addressed.

After running dhclient, use nslookup, a simple command-line DNS query tool, to ask the target DNS server about the name and look for a DHCID record. In the example, a DHCID record was created, which means Name Protection is on.

After running dhclient, we can use nslookup to query the target DNS server and look for a DHCID record (Figure 5).
After running dhclient, we can use nslookup to query the target DNS server and look for a DHCID record (Figure 5). From the original on akamai.com

Step 4: Work out when the server creates records

Three different settings decide when the DHCP server will create a DNS record for a client:

  • Dynamically update only if requested by the client. This is the default. A record is created only if the request contains the FQDN option and the Server flag is set.
  • Always dynamically update. A record is created for any request that carries the FQDN option, whether or not the Server flag is set.
  • Dynamically update for clients that do not request updates. A record is created even when the FQDN option is missing, using the Hostname option to build the name. This exists to support very old clients that never learned to send the FQDN option.
There are three options that determine in which cases the DHCP server will create DNS records for clients (Figure 6).
There are three options that determine in which cases the DHCP server will create DNS records for clients (Figure 6). From the original on akamai.com

Why does the attacker care? Because knowing the setting lets them listen to DHCP requests on the network and spot the ones that will cause the server to create a record. Those records are called managed records, meaning records the server created on someone else's behalf. They are the candidates for a managed record overwrite, which is the spoofing of a record the server itself made.

The setting is deduced from side effects. The attacker triggers an update under each of the three conditions and then asks DNS whether a record appeared. The dhclient configuration for each test is:

Bash
  # Only include the hostname option, without the FQDN option
  send host-name = “test.aka.test”;
  send dhcp-server-identifier [redacted];

Line by line: the comment line explains the intent. send host-name sets the Hostname option to test.aka.test, which is the old-style way of announcing a name. No FQDN option is sent at all. The last line again targets the specific server [redacted]. If a record appears after this, the server is using the third setting.

Bash
  # Include the FQDN option, without the server update flag
  send fqdn.fqdn = “test.aka.test”;
  send dhcp-server-identifier [redacted];

Line by line: here the FQDN option is sent with the name test.aka.test, but the Server flag is deliberately left out. If a record appears anyway, the server is using the second setting, always update.

Bash
  # Include the FQDN option and the server update flag
  send fqdn.fqdn = “test.aka.test”;
  send fqdn.server-update on;
  send dhcp-server-identifier [redacted];

Line by line: this is the full request, with the FQDN option and the Server flag both present. If a record appears only in this case, the server is using the default setting.

Step 5: Respect the limits on the address

For the attack to be useful, the spoofed records must point at a machine the attacker controls. But the address cannot be anything the attacker likes. The DHCP server has a fixed pool of internal addresses and will refuse to lease, and therefore to register, anything outside it. Two limits follow:

  • The address cannot be outside the network, because the server will not lease an external address.
  • The address cannot belong to a machine with a static IP, because static addresses are usually not in the lease pool.

The practical answer is to use whatever address the server offers to the attacker's own internal machine. To keep using that same address for later steps, the attacker asks for it explicitly with the Requested IP Address option:

Bash
  send dhcp-requested-address [redacted];

Line by line: send dhcp-requested-address puts the Requested IP Address option into the request, with the value [redacted]. It is a request, not a demand: the server will honour it only if that address is free and inside its pool.

Step 6: Free the address without losing the record

An attacker usually wants to spoof many names, all pointing at the same machine. That runs into a problem. Once an address is leased, the server will not lease it to anyone else, which is how the network avoids two machines ending up with the same number. After a lease has been used for a spoof, the address is out of the pool, and asking for it again with a different name gets a different address back.

If we try to lease the same IP address again with a different FQDN, the server offers a different address (Figure 7).
If we try to lease the same IP address again with a different FQDN, the server offers a different address (Figure 7). From the original on akamai.com

Simply releasing the lease does not help either. A release tells the server the client is done with the address, and the server responds by deleting the DNS record that went with it, wiping out the spoofed record.

We can't solve this problem by releasing the previous lease, because this would trigger a DNS Dynamic Update by the DHCP server to delete the record that was just released — and would remove our previously spoofed record (Figure 8).
We can't solve this problem by releasing the previous lease, because this would trigger a DNS Dynamic Update by the DHCP server to delete the record that was just released — and would remove our previously spoofed record (Figure 8). From the original on akamai.com

So the attacker needs two things at once: the address back in the pool, and the existing DNS record left alone. The researcher found a server behaviour that does both. The attacker sends a DHCP Request to the server that currently holds the lease, containing:

  • the Client MAC address that was used to obtain the existing lease;
  • the Server Identifier of a server different from the targeted one.

A MAC address is the hardware identifier burned into a network card, and it is how the DHCP server tells clients apart. When the targeted server sees this broadcast, it concludes that the client is now asking a different server for a new address and no longer needs the old one. It deletes the lease, but leaves the associated DNS record in place. Why the record survives is not clear; the researcher suspects a logical bug.

It will then delete the IP lease without deleting the associated DNS record (Figure 9).
It will then delete the IP lease without deleting the associated DNS record (Figure 9). From the original on akamai.com

Step 7: Register two names on one address

With that behaviour understood, the sequence is simple. Create the first record with dhclient exactly as described earlier. The record appears, and the lease is visible in the DHCP server's lease table.

Our record is created, and if we look at the DHCP server lease table we can see our lease is present there (Figure 10).
Our record is created, and if we look at the DHCP server lease table we can see our lease is present there (Figure 10). From the original on akamai.com

Then change the dhcp-server-identifier option in the configuration file to any other IP address, and run dhclient again. The lease is deleted. Run dhclient once more with a different FQDN while requesting the same address, and a second record is created. Both names now point at the same machine.

We can now simply run dhclient again with a different FQDN while requesting the same IP address and create a second record (Figure 11).
We can now simply run dhclient again with a different FQDN while requesting the same IP address and create a second record (Figure 11). From the original on akamai.com

Step 8: Let DDSpoof do the enumeration

DDSpoof is a Python tool that performs DHCP server enumeration, runs custom DHCP DNS commands and identifies spoofing targets. It is run against the network, with the interface used to send and receive packets specified.

We will first run DDSpoof to scan the network and identify potential targets (specifying which interface to use for sending and receiving packets; Figure 12).
We will first run DDSpoof to scan the network and identify potential targets (specifying which interface to use for sending and receiving packets; Figure 12). From the original on akamai.com

It does three things: it identifies all reachable DHCP servers and their configurations, it determines Name Protection status, and it checks whether the attacker's current address is available for lease on the target server. In the example the address is not available, so it is manually changed to one the server offers.

In this example, our IP address is not available for lease on our target server, so we manually modify it to the one offered by the server (Figure 13).
In this example, our IP address is not available for lease on our target server, so we manually modify it to the one offered by the server (Figure 13). From the original on akamai.com

Step 9: Spoof a name that does not resolve

The first attack is DHCP DNS spoofing. The idea is to find names that machines are failing to resolve, and then register those names so they point at the attacker. To find them, use the start-llmnr command. It starts an LLMNR sniffer that reports LLMNR queries on the network, which points at potential targets.

This command starts an LLMNR sniffer that will notify us about LLMNR queries in the network, which could lead us toward potential spoofing targets (Figure 14).
This command starts an LLMNR sniffer that will notify us about LLMNR queries in the network, which could lead us toward potential spoofing targets (Figure 14). From the original on akamai.com

In the example the sniffer identifies files.aka.test. The write-record command then attempts to register that name.

Now, we can use the write-record command to attempt to register this DNS name (Figure 15).
Now, we can use the write-record command to attempt to register this DNS name (Figure 15). From the original on akamai.com

DDSpoof creates the record pointing at the attacker's address, and nslookup confirms it.

As we can see, DDSpoof successfully creates this DNS record, pointing to our IP address! We can verify this with nslookup (Figure 16).
As we can see, DDSpoof successfully creates this DNS record, pointing to our IP address! We can verify this with nslookup (Figure 16). From the original on akamai.com

From then on, any host on the network that resolves files.aka.test is sent to the attacker's machine. When the attack is over, the delete-record command removes the spoofed record.

When we are done with our attack, we can use the delete-record command to remove our spoofed record (Figure 17).
When we are done with our attack, we can use the delete-record command to remove our spoofed record (Figure 17). From the original on akamai.com

Step 10: Overwrite a name that already exists

The second attack is DHCP DNS overwrite. Look back at the enumeration output: the target DHCP server is also a DNS server. That hints it may also be a Domain Controller, since DNS is often installed on a Domain Controller in Active Directory environments. The check uses nmap:

Bash
  Nmap -p389 -sV 172.25.14.123

Line by line: Nmap is the program. -p389 tells it to probe port 389, the LDAP port that Domain Controllers listen on. -sV asks it to identify the service and version behind that port. [redacted] is the machine being probed.

The results confirm our suspicions (Figure 18).
The results confirm our suspicions (Figure 18). From the original on akamai.com

If no DNS credential is configured on the server, any record in the ADI zone can be overwritten. In the example a host named file-server.aka.test is identified.

Let's say we identified a host named file-server.aka.test (Figure 19).
Let's say we identified a host named file-server.aka.test (Figure 19). From the original on akamai.com

The write-record command attempts the overwrite. If a weak DNS credential had been configured, this should fail. Here none was configured, so the overwrite succeeded.

We can verify that the overwrite was successful by using nslookup again (Figure 21).
We can verify that the overwrite was successful by using nslookup again (Figure 21). From the original on akamai.com
We can verify that the overwrite was successful by using nslookup again (Figure 21).
We can verify that the overwrite was successful by using nslookup again (Figure 21).

Step 11: Get past Name Protection

The third attack targets a name that is protected. The start-dhcp command sniffs DHCP traffic and identifies DHCP Request messages.

In another scenario, we run the start-dhcp DDSpoof command that sniffs DHCP traffic, identifying DHCP Request messages (Figure 22).
In another scenario, we run the start-dhcp DDSpoof command that sniffs DHCP traffic, identifying DHCP Request messages (Figure 22). From the original on akamai.com

In the example a machine named ubuntu-server.aka.test sends a request containing its FQDN, which may lead the server to create a record for it. That is an opportunity for a managed record overwrite. Managed records are created for non-Windows hosts, because those machines are not part of the domain and cannot talk to the DNS server directly, so the DHCP server has to do it for them. The obstacle is that this server has Name Protection enabled.

Our target DHCP server has enabled Name Protection (Figure 23).
Our target DHCP server has enabled Name Protection (Figure 23). From the original on akamai.com

Querying all records for ubuntu-server.aka.test shows a DHCID record is present, confirming the protection.

If we query all the DNS records for our target ubuntu-server.aka.test, we see that a DHCID record is indeed present (Figure 24).
If we query all the DNS records for our target ubuntu-server.aka.test, we see that a DHCID record is indeed present (Figure 24). From the original on akamai.com

Name Protection is bypassed by sending a DHCP Release with a Client ID (CID), essentially the client MAC address, that matches the original record owner. With a CID matching the original record owner, the server deletes the record. The set-cid command is given the target CID obtained earlier, so DDSpoof impersonates the original client. The delete-record command then removes the target record.

After this, we can run the delete-record command to remove our target record (Figure 25).
After this, we can run the delete-record command to remove our target record (Figure 25). From the original on akamai.com

Finally, write-record registers the name for the attacker.

Why this works at all

The root cause is the DHCP DNS Dynamic Update feature itself. A server that registers records on behalf of unauthenticated clients will register whatever names an attacker chooses, as long as the request carries the right options. The specific behaviour that makes multi-record spoofing practical is the lease deletion: a Request carrying the original client MAC and a foreign Server Identifier makes the server drop the lease but leave the DNS record in place. The researcher suspects this is a logical bug. Name Protection, the control meant to stop overwrites, is bypassed because the Release is accepted with a spoofed CID matching the legitimate owner.

What an attacker could do with it

From an unauthenticated position, an attacker can spoof various DNS records in Active Directory domains. The report lists examples: targeting Windows machines to intercept NTLM or Kerberos authentication, which can then be relayed or brute-forced; targeting applications that use insecure protocols to intercept sensitive data; and targeting the records of internal security servers such as antivirus or SIEM, to block access to them. The report calls these a few examples among many. The tool alone is not enough to cause damage: it needs network access and further exploitation to abuse the DNS spoofing primitive.

What Microsoft said

Microsoft responded that the reported problems are either by design or not severe enough to receive a fix, so the surface is likely to remain. No fix was applied. Instead, the report points security teams at two tools: Invoke-DHCPCheckup, to identify DHCP and DNS configurations in Active Directory, and DDSpoof, to highlight risks and test resilience to the DHCP DNS Dynamic Update attack surface.

Things a defender can test

  • Parameter Request List enumeration. Add request domain-name, domain-name-servers; to the client config and inspect the Offer. A positive result is an Offer carrying the zone suffix and DNS server, which tells you which records are spoofable through that server.
  • Name Protection deduction. Trigger an update with the FQDN option and Server flag, then query for a DHCID record. A DHCID alongside the A record means Name Protection is on.
  • Dynamic Update setting deduction. Run the three configurations above and check DNS after each. A record appearing without the FQDN option indicates the third setting; one appearing without the Server flag indicates the second; one appearing only with both indicates the default.
  • Lease deletion without record deletion. Lease an address, then send a Request with the original MAC and a foreign Server Identifier. A positive result is the lease gone from the lease table while the DNS record still resolves.
  • Overwrite without a DNS credential. Identify a host record and attempt write-record. Success means no DNS credential is configured.
  • Name Protection bypass. Sniff a DHCP Request to obtain the target CID, send a Release with set-cid, then delete-record and write-record. Success means the protected name can be taken over.

Glossary

  • A record: the standard DNS record that maps a name to an IP address.
  • Active Directory: Microsoft's system for managing users, computers and other objects in a company network.
  • ADIDNS: Active Directory Integrated DNS, the DNS zone stored inside Active Directory itself.
  • ADI zone: a DNS zone held in Active Directory, tied to a domain suffix such as aka.test.
  • CID (Client ID): the identifier a DHCP client uses, essentially its MAC address.
  • Client MAC address: the hardware identifier of a network card, used by DHCP to tell clients apart.
  • DHCP: Dynamic Host Configuration Protocol, the system that hands out IP addresses and network settings.
  • DHCP Discover: the broadcast a client sends to ask whether any DHCP servers are present.
  • DHCP Offer: a server's reply to a Discover, proposing an address and settings.
  • DHCP Release: a message telling the server the client is done with its address.
  • DHCP Request: the message a client sends to formally ask for an address.
  • DHCID record: a DNS record created alongside an A record when Name Protection is on, acting as a claim ticket.
  • DDSpoof: the Python tool released with the research, which automates DHCP DNS attacks.
  • DNS: Domain Name System, the phone book that turns names into IP addresses.
  • DNS spoofing: making a name resolve to an address the attacker controls.
  • Domain Controller (DC): the central server in an Active Directory network, handling logins and often DNS.
  • Domain Name option: a DHCP option carrying the zone suffix.
  • Domain Name Server option: a DHCP option carrying the address of the DNS server.
  • FQDN: fully qualified domain name, the complete name of a machine including its domain.
  • FQDN option: a DHCP option in which the client sends its FQDN.
  • Hostname option: an older DHCP option carrying just the machine name.
  • Invoke-DHCPCheckup: a tool that identifies DHCP and DNS configurations in Active Directory.
  • IP address: the numeric address of a device on a network.
  • Kali Linux: a Linux distribution that ships with security tools.
  • LDAP: the directory protocol Domain Controllers speak, on port 389.
  • Lease: an address lent by a DHCP server to a client for a period of time.
  • Lease table: the server's record of which client holds which address.
  • LLMNR: a fallback name lookup Windows uses when DNS fails, shouting names onto the local network.
  • Managed record: a DNS record the DHCP server created on behalf of a client.
  • Managed record overwrite: spoofing a record that the DHCP server itself created.
  • MAC address: see Client MAC address.
  • Name Protection: a Microsoft DHCP setting that adds a DHCID record to stop unauthorised changes.
  • NTLM: one of the ways Windows machines prove their identity to each other.
  • Kerberos: the other main Windows authentication protocol.
  • nmap: a tool that probes a machine's ports to identify running services.
  • nslookup: a command-line tool for querying DNS.
  • Parameter Request List: a DHCP option listing the settings the client wants the server to include in its reply.
  • Port: a numbered door on a machine through which a service is reached.
  • Python: a programming language; DDSpoof is written in it.
  • Requested IP Address option: a DHCP option asking the server for a specific address.
  • Server flag: a flag inside the FQDN option asking the server to perform the DNS registration.
  • Server Identifier option: a DHCP option naming which DHCP server is being addressed.
  • SIEM: a system that collects and analyses security logs.
  • Sniffer: a program that listens to network traffic and reports what it sees.
  • Static IP: an address configured by hand on a machine rather than leased from DHCP.
  • Virtual interface: a pretend network card created in software on top of a real one.
  • Zone: a domain suffix under which DNS records live, such as aka.test.

More by Ori David

View all

2 more disclosed reports, best first.

More from Microsoft

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.