BSDSec

deadsimple BSD Security Advisories and Announcements

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

-----BEGIN PGP SIGNED MESSAGE-----
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 <grembo@FreeBSD.org>
                Dag-Erling Smørgrav <des@FreeBSD.org>
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
<URL:https://security.FreeBSD.org/>.

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 8.8.8.8
  nameserver 127.0.0.1

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
increased.

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)
utility:

# 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 https://security.FreeBSD.org/patches/EN-24:11/ldns.patch
# fetch https://security.FreeBSD.org/patches/EN-24:11/ldns.patch.asc
# 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:https://www.FreeBSD.org/handbook/makeworld.html>.

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:

<URL:https://cgit.freebsd.org/src/commit/?id=NNNNNN>

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

<URL:https://bugs.freebsd.org/bugzilla/show_bug.cgi?id'8721>

<URL:https://github.com/NLnetLabs/ldns/issues/237>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-EN-24:11.ldns.asc>
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmZzRTkACgkQbljekB8A
Gu9BYBAApSQZbv3wgT5PhJRsaCulmOZOH5gywlVdaBA1I4sDF3on0CFwLQfy7lLH
q2xFEfll5vBVbfGCVp2zVBgb4IyknqMgf8Ae4uBEEJJejRgxxnFTnQmdlzg7a8TR
9UW3g6QB/5tUIGrxFqIdx4qRAQz1ie6NwR+KvP8ojXk0xVscKIaijXACbmAgT6nH
HygG7snrB9VmMMlRIHYhoarhRBd+aX68Jg3F+yGUX76FB4HVMSFMYo0fEWgi7SQ3
psZfq54GvCH+kSvYduXS3QkTJ7N/S9p6JAVraRlJmFnjQ69qE7u59bc68zW0D2pn
Pj6/c0OZtWE2SQGqCuqgnBffjArisAJ/BKiK/XeO8B1fSvaVKJToR18+6KGTmc0f
nnqQLxFeGbh5gHHcM8QaLBJFUgm5TVvdevcDmLuiVMSvQyt5iC6rIGwb3UNYAnW7
w/UFSresVKppsB2JDqyGjaSf2FI00rYIKHChZ8nkKYPMhb6V/TJZr3k25/3idbvi
6zO7wfbOhwAYQ44Mg/gY/v206qpoYiZO2tMQazbiicOqBOQBYWdXsojYhCB6qkyU
++kBNAMugpOAsDkIvN9mWLniRnvycrbEqthQlmfR7X3tZRiuz+0S1alx03Z5VsP6
zM5//i6W2Lt8DmX34zQDeQAMTZXD3bG1JSe2UbKyZkL20vrSTfg=lQUa
-----END PGP SIGNATURE-----