-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
=============================================================================
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 .
Note: This advisory introduced additional issues that were addressed by
FreeBSD-EN-24:16.pf. Please refer to that erratum for additional fixes.
0. Revision History
v1.0 2024-08-07 -- Initial release
v1.1 2024-09-19 -- Add reference to EN-24:16.pf
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
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
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
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmbsNYgACgkQbljekB8A
Gu/+9Q/9H++Mts0NlrhE3hsCOats5GpAtsq/hRByjZx0flGwIKyIhvHh364hAWDQ
gvdzWijlrYz86jiekM+CEpg08lkCKKm9jM22AaA2uZqIaUNgh0blenDMvAOqJc4W
e08vmW1Q7RopuT3mjJHhqC9mU6s6B5aaAdjFfkKBRdp+BtMnTZmaH1Bx/acHx7SL
R9WVIDUMEQVorqo1/2YnuO+LrAaiFEKkJ7YN+CS/wN2IbDaupyny1fWKffhBGu0C
Hg/gubJuLGqlBvmDp88Mi+kxyzkw9+MbR3haS2P13FFxDj80JEhaH71hG7CAZ5xd
1S1qv2PvpEKw8TdH249Z0YVK1aUA6h3wy6TWrQkM1YjaWzHY3XJoMq90OwluQQTI
fw5njyLrVvYonHQLqLRv59hlC/0V9+Utpy8cvRA9d7dRf/JBarsFVhp5F7IQDLuq
qE/vf+0lRa7WwFkr+FWfP4Cgt+I39DJFW0nybtll4eJfR5+0j+vGsaZZM973S94F
xkqAU3xXulpQvT1qHvf7d7UY24H7Kmbzet0LNd30PrWT+uRktpZ164wHRZd96eHg
3TXOvSTgqIzvsuxcBI0vh+5EWbTgMKOG21zSwwzbDMM1vNI/39YYJaWnNlUFH17+
w0sm1aAF9P4vbAz7n+hxQVJFEAZwSChIfuPEuV8QKJGbpyqoDm8=
=iMcB
-----END PGP SIGNATURE-----