What is DNS Cache Locking in Windows Server 2008 R2 ?

Standard

One of the DNS improvements in Windows Server 2008 R2 is DNS Cache Locking in which if configured the cache entries are not allowed to be modified for the percentage of TTL.

Cache locking is a new security feature available with Windows Server® 2008 R2 that allows you to control whether or not information in the DNS cache can be overwritten. When a recursive DNS server responds to a query, it will cache the results obtained so that it can respond quickly if it receives another query requesting the same information. The period of time the DNS server will keep information in its cache is determined by the Time to Live (TTL) value for a resource record. Until the TTL period expires, information in the cache might be overwritten if updated information about that resource record is received. If an attacker successfully overwrites information in the cache, they might be able to redirect traffic on your network to a malicious site.

Cache locking is configured as a percent value. For example, if the cache locking value is set to 50, then the DNS server will not overwrite a cached entry for half of the duration of the TTL. By default, the cache locking percent value is 100. This means that cached entries will not be overwritten for the entire duration of the TTL. The cache locking value is stored in the CacheLockingPercent registry key. If the registry key is not present, then the DNS server will use the default cache locking value of 100.

You can configure the CacheLocking with DNSCMD utility from the command line (launched under elevated rights).

dnscmd /Config /CacheLockingPercent <percent>

You may also check the current percentage set for this setting with the /info switch of DNSCMD.

DNScachelocking

With above, the pertinent DWORD registry key is created under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\DNS\Parameters

However, in real world you push down this registry key via Group Policy Preferences to all your DNS servers. Values for the key are shown below.

DNScachelocking1