deadsimple BSD Security Advisories and Announcements

FreeBSD Errata Notice FreeBSD-EN-24:11.ldns

Hash: SHA512

FreeBSD-EN-24:11.ldns                                           Errata Notice
                                                          The FreeBSD Project

Topic:          LDNS uses nameserver commented out in resolv.conf

Category:       contrib
Module:         ldns
Announced:      2024-06-19
Credits:        Michael Gmelin <>
                Dag-Erling Smørgrav <>
Affects:        FreeBSD 13.3 and FreeBSD 14.0.
Corrected:      2024-05-20 09:04:54 UTC (stable/14, 14.0-STABLE)
                2024-06-19 20:36:59 UTC (releng/14.0, 14.0-RELEASE-p7)
                2024-05-20 09:04:59 UTC (stable/13, 13.3-STABLE)
                2024-06-19 20:37:08 UTC (releng/13.3, 13.3-RELEASE-p3)

For general information regarding FreeBSD Errata Notices and Security
Advisories, including descriptions of the fields above, security
branches, and the following sections, please visit

I.   Background

LDNS is a DNS library that facilitates DNS tool programming.

II.  Problem Description

Due to a bug in the library's configuration file parser, commented out
configuration settings in /etc/resolv.conf were picked up by the LDNS
resolver, potentially leading to malfunction and/or information leakage.

This included, but was not limited to, the nameserver setting. Given
this example

  # /etc/resolv.conf

  # nameserver

DNS requests were sent to the commented out external resolver instead
of the local one.

III. Impact

Programs using the LDNS library might behave in unexpected ways. Name
resolution could be inconsistent with what other tools which use libc
return, e.g., `ping` vs. `host`. DNS request containing private
information could leak to third parties. A system's attack surface is

Affected tools include host(1), drill(1), and ssh(1), which uses
LDNS in the VerifyHostKeyDNS feature to fetch SSHFP records.

IV.  Workaround

Removing empty lines from /etc/resolv.conf mitigates the problem:

    sed -i '' '/^[[:space:]]*$/d' /etc/resolv.conf

V.   Solution

Upgrade your system to a supported FreeBSD stable or release / security
branch (releng) dated after the correction date.

Perform one of the following:

1) To update your system via a binary patch:

Systems running a RELEASE version of FreeBSD on the amd64 or arm64 platforms,
or the i386 platform on FreeBSD 13, can be updated via the freebsd-update(8)

# freebsd-update fetch
# freebsd-update install

2) To update your system via a source code patch:

The following patches have been verified to apply to the applicable
FreeBSD release branches.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch
# fetch
# gpg --verify ldns.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Recompile the operating system using buildworld and installworld as
described in <URL:>.

Restart all daemons that use the library, or reboot the system.

VI.  Correction details

This issue is corrected as of the corresponding Git commit hash in the
following stable and release branches:

Branch/path                             Hash                     Revision
- -------------------------------------------------------------------------
stable/14/                              7daf36028411    stable/14-n267742
releng/14.0/                            bdf75e830a77  releng/14.0-n265418
stable/13/                              e95e16191f63    stable/13-n257915
releng/13.3/                            d45cf1d2f124  releng/13.3-n257434
- -------------------------------------------------------------------------

Run the following command to see which files were modified by a
particular commit:

# git show --stat <commit hash>

Or visit the following URL, replacing NNNNNN with the hash:


To determine the commit count in a working tree (for comparison against
nNNNNNN in the table above), run:

# git rev-list --count --first-parent HEAD

VII. References



The latest revision of this advisory is available at