Chapter 7. BIND 9 Security Considerations

Table of Contents
7.1. Access Control Lists
7.2. chroot and setuid (for UNIX servers)
7.3. Dynamic Update Security

7.1. Access Control Lists

Access Control Lists (ACLs), are address match lists that you can set up and nickname for future use in allow-notify, allow-query, allow-recursion, blackhole, allow-transfer, etc.

Using ACLs allows you to have finer control over who can access your nameserver, without cluttering up your config files with huge lists of IP addresses.

It is a good idea to use ACLs, and to control access to your server. Limiting access to your server by outside parties can help prevent spoofing and DoS attacks against your server.

Here is an example of how to properly apply ACLs:

// Set up an ACL named "bogusnets" that will block RFC1918 space,
// which is commonly used in spoofing attacks.
acl bogusnets {;;;;;;;; };
// Set up an ACL called our-nets. Replace this with the real IP numbers.
acl our-nets { x.x.x.x/24; x.x.x.x/21; }; 
options {
  allow-query { our-nets; };
  allow-recursion { our-nets; };
  blackhole { bogusnets; };
zone "" {
  type master;
  file "m/";
  allow-query { any; };

This allows recursive queries of the server from the outside unless recursion has been previously disabled.

For more information on how to use ACLs to protect your server, see the AUSCERT advisory at

7.2. chroot and setuid (for UNIX servers)

On UNIX servers, it is possible to run BIND in a chrooted environment (chroot()) by specifying the "-t" option. This can help improve system security by placing BIND in a "sandbox," which will limit the damage done if a server is compromised.

Another useful feature in the UNIX version of BIND is the ability to run the daemon as a nonprivileged user ( -u user ). We suggest running as a nonprivileged user when using the chroot feature.

Here is an example command line to load BIND in a chroot() sandbox, /var/named, and to run named setuid to user 202:

/usr/local/bin/named -u 202 -t /var/named

7.2.1. The chroot Environment

In order for a chroot() environment to work properly in a particular directory (for example, /var/named), you will need to set up an environment that includes everything BIND needs to run. From BIND's point of view, /var/named is the root of the filesystem. You will need /dev/null, and any library directories and files that BIND needs to run on your system. Please consult your operating system's instructions if you need help figuring out which library files you need to copy over to the chroot() sandbox.

If you are running an operating system that supports static binaries, you can also compile BIND statically and avoid the need to copy system libraries over to your chroot() sandbox.

7.2.2. Using the setuid Function

Prior to running the named daemon, use the touch utility (to change file access and modification times) or the chown utility (to set the user id and/or group id) on files to which you want BIND to write.

7.3. Dynamic Update Security

Access to the dynamic update facility should be strictly limited. In earlier versions of BIND the only way to do this was based on the IP address of the host requesting the update, by listing an IP address or network prefix in the allow-update zone option. This method is insecure since the source address of the update UDP packet is easily forged. Also note that if the IP addresses allowed by the allow-update option include the address of a slave server which performs forwarding of dynamic updates, the master can be trivially attacked by sending the update to the slave, which will forward it to the master with its own source IP address causing the master to approve it without question.

For these reasons, we strongly recommend that updates be cryptographically authenticated by means of transaction signatures (TSIG). That is, the allow-update option should list only TSIG key names, not IP addresses or network prefixes. Alternatively, the new update-policy option can be used.

Some sites choose to keep all dynamically updated DNS data in a subdomain and delegate that subdomain to a separate zone. This way, the top-level zone containing critical data such as the IP addresses of public web and mail servers need not allow dynamic update at all.