Actions
Regression #16672
openFirewall rules matching and tagging across distinct anchors are ignored by subsequent tagged rule
Start date:
Due date:
% Done:
100%
Estimated time:
Plus Target Version:
26.03
Release Notes:
Default
Affected Version:
2.9.0
Affected Architecture:
All
Description
Starting at pfSense Plus 25.11 our team noticed a bug occurring on x86 hardware such as the Netgate 4200/6100.
I've tested on Netgate 2100 (aarch64) and Netgate 3100 (armv7) and the issue does not occur there.
The bug gets triggered when two same or similar match rules (attaching a tag) under two distinct anchors (depth 1 and 2 tested) match a packet. In this scenario any remaining rules that would match such packet by tag get ignored and a default rule applies.
Basic Reproduction in pf¶
block in inet all anchor "first" { match from <ip_address_or_table> to <ip_address_or_table> tag "allow" } anchor "second" { match from <ip_address_or_table> to <ip_address_or_table> tag "allow" } pass in quick on <interface> inet from any to any tagged "allow" keep state
Meanwhile this works:
block in inet all
anchor "firstandonly" {
match from <ip_address_or_table> to <ip_address_or_table> tag "allow"
}
pass in quick on <interface> inet from any to any tagged "allow" keep state
Steps to Reproduce on pfSense¶
- Delete all firewall rules on the LAN interface, and create a single allow any rule that allows traffic tagged with
example_tag. - Run the attached script
matching-anchor-bug.shon the pfSense appliance. It creates the test match rules under theuserrules/*anchor. - From an endpoint on the LAN, try to ping
208.123.73.78. - Notice in
/var/log/filter.logthat the match rules get hit, but the pass rule you created in the LAN interface does not. - Now re-run the script as follows:
./matching-anchor-bug.sh single-anchor - Notice how the ping immediately starts to be passed as it's now hitting your pass rule.
Files
Updated by Arthur Wiebe 21 days ago
It appears this may be resolved in freebsd as of this commit https://github.com/freebsd/freebsd-src/commit/4616481212302b5d875cfc7a00766af017318f7f
Updated by Jim Pingle 20 days ago
- Project changed from pfSense Plus to pfSense
- Subject changed from pf: Rules matching and tagging across distinct anchors are ignored by subsequent tagged rule to Firewall rules matching and tagging across distinct anchors are ignored by subsequent tagged rule
- Category changed from packetfilter to Rules / NAT
- Assignee set to Kristof Provost
- Target version set to 2.9.0
- Affected Plus Version deleted (
25.11.1) - Plus Target Version set to 26.03
That should get picked up in our next upstream src merge here shortly.
Actions