]> git.hungrycats.org Git - linux/commit
netfilter: nfnetlink_queue: restrict writes to network header
authorFlorian Westphal <fw@strlen.de>
Tue, 9 Jun 2026 11:51:53 +0000 (13:51 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 30 Jun 2026 04:45:45 +0000 (06:45 +0200)
commit54f34607d184c1cc056c59a5b3d86d96dd6a515c
treedd3687a98568825c5ff0ed25058fe22fdd455292
parentd07955dd34ecae17d35d8c7d0a273a3fba653a8c
netfilter: nfnetlink_queue: restrict writes to network header

nfnetlink_queue doesn't allow selective replacements of some part of the
payload, only complete replacement.
If the new data is shorter, skb is trimmed, otherwise expanded.

Add minimal validation of the new ip/ipv6 header.  Check total len
matches skb length.  Disallow ip option modifications.

IPv6 extension headers are also disabled.
IP options and exthdrs could be allowed later after validation pass or
ip option recompile.

Transport header is not checked.

Bridge modifications are rejected.  Given userspace doesn't even receive
L2 headers, use is limited and I don't think there are any users of
bridge nfnetlink_queue, let alone users that modifiy payload.

Arp isn't supported at all.

Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nfnetlink_queue.c