Netdev List
 help / color / mirror / Atom feed
* [PATCH nf 0/2] netfilter: reject mismatched conntrack template protocols
@ 2026-11-27 21:09 Dickson Wu via B4 Relay
  2026-11-27 18:12 ` [PATCH nf 1/2] netfilter: conntrack: reject helper protocol mismatch Dickson Wu via B4 Relay
  2026-11-27 18:12 ` [PATCH nf 2/2] netfilter: conntrack: reject timeout " Dickson Wu via B4 Relay
  0 siblings, 2 replies; 5+ messages in thread
From: Dickson Wu via B4 Relay @ 2026-11-27 21:09 UTC (permalink / raw)
  To: netfilter-devel
  Cc: Pablo Neira Ayuso, Florian Westphal, Phil Sutter, coreteam,
	netdev

xt_CT under nft_compat can attach a helper or timeout policy selected from
NFTA_RULE_COMPAT_PROTO to packets of another protocol. The helper mismatch
also affects act_ct through the common template assignment path.

Reject mismatched helpers and timeout policies when a conntrack copies its
template state.

Tested under UML with KASAN, with the trigger running as uid 1000 in new
user and network namespaces (namespace-local CAP_NET_ADMIN only):

- nft_compat xt_CT with the H.323 RAS helper on TCP: stock panics in
  mangle_contents(); patched completes; reverted panics again.
- act_ct with the RAS helper on TCP: stock panics in ras_help() from the
  receive softirq; patched completes; reverted panics again.
- xt_CT with an ICMP timeout policy on TCP: stock gives a KASAN
  slab-out-of-bounds read in nf_conntrack_tcp_packet(); patched keeps the
  default TCP timeout; reverted reads out of bounds again.
- Matching-protocol controls still work: UDP H.323, TCP FTP, and ICMP
  and UDP timeout policies.

W=1 builds are clean. The rule-load checks in xt_CT and nft_ct already
require an exact protocol match, so valid configurations are unaffected.
The gap is nft_compat not enforcing its compat protocol per packet, and
act_ct.

A reproducer is available if it helps.

This was found and the fix prepared with AI coding tools (OpenAI Codex
agents, with review by Claude). I went over the analysis and the patch
before signing off.

---
Dickson Wu (2):
      netfilter: conntrack: reject helper protocol mismatch
      netfilter: conntrack: reject timeout protocol mismatch

 net/netfilter/nf_conntrack_core.c   | 10 +++++++---
 net/netfilter/nf_conntrack_helper.c |  2 ++
 2 files changed, 9 insertions(+), 3 deletions(-)
---
base-commit: 734bef548a96e8774d6eef5dfa2026c6edc4e80b
change-id: 20261127-nf-ctproto2-0508bd9bfeb7

Best regards,
--  
Dickson Wu <dickson.wu@certik.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-28 22:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 21:09 [PATCH nf 0/2] netfilter: reject mismatched conntrack template protocols Dickson Wu via B4 Relay
2026-11-27 18:12 ` [PATCH nf 1/2] netfilter: conntrack: reject helper protocol mismatch Dickson Wu via B4 Relay
2026-11-28 22:02   ` Pablo Neira Ayuso
2026-11-28 22:34     ` Dickson Wu
2026-11-27 18:12 ` [PATCH nf 2/2] netfilter: conntrack: reject timeout " Dickson Wu via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox