From: Dickson Wu via B4 Relay <devnull+dickson.wu.certik.com@kernel.org>
To: netfilter-devel@vger.kernel.org
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
coreteam@netfilter.org, netdev@vger.kernel.org
Subject: [PATCH nf 0/2] netfilter: reject mismatched conntrack template protocols
Date: Fri, 27 Nov 2026 21:09:11 +0000 [thread overview]
Message-ID: <20261127-nf-ctproto2-v1-0-b5383cef8da2@certik.com> (raw)
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>
next reply other threads:[~2026-11-27 21:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 21:09 Dickson Wu via B4 Relay [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127-nf-ctproto2-v1-0-b5383cef8da2@certik.com \
--to=devnull+dickson.wu.certik.com@kernel.org \
--cc=coreteam@netfilter.org \
--cc=dickson.wu@certik.com \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox