Home / mailings FreeBSD Security Advisory FreeBSD-SA-24:05.pf
Posted on 07 August 2024
FreeBSD security notificat=============================================================================FreeBSD-SA-24:05.pf Security Advisory
The FreeBSD Project
Topic: pf incorrectly matches different ICMPv6 states in the state table
Category: core
Module: pf
Announced: 2024-08-07
Credits: Enrico Bassetti e.bassetti@tudelft.nl
(Cybersecurity @ TU Delft, SPRITZ Group @ UniPD)
Affects: All supported versions of FreeBSD.
Corrected: 2024-07-31 07:41:11 UTC (stable/14, 14.0-STABLE)
2024-08-07 13:44:25 UTC (releng/14.1, 14.1-RELEASE-p3)
2024-08-07 13:44:46 UTC (releng/14.0, 14.0-RELEASE-p9)
2024-07-31 07:41:12 UTC (stable/13, 13.3-STABLE)
2024-08-07 13:44:57 UTC (releng/13.3, 13.3-RELEASE-p5)
CVE Name: CVE-2024-6640
For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit <URL:https://security.FreeBSD.org/>.
I. Background
pf is an Internet Protocol packet filter originally written for OpenBSD. pf
uses a state table to determine whether to allow a packet that is from a
known/already open transmission. It identifies ICMPv6 states based on the
address family, protocol, addresses, and the ID.
Normally, states are created by outgoing packets, or by incoming packets
matching 'pass' rules. A packet that do not match any rule will be blocked
or allowed depending on the default rule.
ICMPv6 Neighbor Discovery has to be allowed in the firewall for IPv6 to work
properly in broadcast networks, such as Ethernet.
II. Problem Description
In ICMPv6 Neighbor Discovery (ND), the ID is always 0. When pf is configured
to allow ND and block incoming Echo Requests, a crafted Echo Request packet
after a Neighbor Solicitation (NS) can trigger an Echo Reply. The packet has
to come from the same host as the NS and have a zero as identifier to match
the state created by the Neighbor Discovery and allow replies to be
generated.
III. Impact
ICMPv6 packets with identifier value of zero bypass firewall rules written on
the assumption that the incoming packets are going to create a state in the
state table.
IV. Workaround
No workaround is available but systems not using the pf firewall are not
affected.
V. Solution
Upgrade your vulnerable system to a supported FreeBSD stable or
release / security branch (releng) dated after the correction date
and reboot.
Perform one of the following:
1) To update your vulnerable 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
# shutdown -r +10min "Rebooting for a security update"
2) To update your vulnerable 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.
[FreeBSD 13.3]
# fetch https://security.FreeBSD.org/patches/SA-24:05/pf-13.patch
# fetch https://security.FreeBSD.org/patches/SA-24:05/pf-13.patch.asc
# gpg --verify pf.patch.asc
[FreeBSD 14.0 & FreeBSD 14.1]
# fetch https://security.FreeBSD.org/patches/SA-24:05/pf-14.patch
# fetch https://security.FreeBSD.org/patches/SA-24:05/pf-14.patch.asc
# gpg --verify pf.patch.asc
b) Apply the patch. Execute the following commands as root:
# cd /usr/src
# patch < /path/to/patch
c) Recompile your kernel as described in
<URL:https://www.FreeBSD.org/handbook/kernelconfig.html> and 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/ 3382c691dc6a stable/14-n268277
releng/14.1/ a66d33fcf334 releng/14.1-n267690
releng/14.0/ ca9580967e74 releng/14.0-n265428
stable/13/ 05f91f8dd5ce stable/13-n258160
releng/13.3/ 5eb30c313cb0 releng/13.3-n257443
- -------------------------------------------------------------------------
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://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-6640>
The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-24:05.pf.asc>