|
|
Log in / Subscribe / Register

netfilter: add restrictions/validations for packet rewrite

From:  Florian Westphal <fw-AT-strlen.de>
To:  <netfilter-devel-AT-vger.kernel.org>
Subject:  [PATCH nf-next v2 0/3] netfilter: add restrictions/validations for packet rewrite
Date:  Mon, 08 Jun 2026 17:23:15 +0200
Message-ID:  <20260608152324.20700-1-fw@strlen.de>
Cc:  Florian Westphal <fw-AT-strlen.de>
Archive-link:  Article

Changes since v1:
 - add patch 3.  Patches 1 and 2 are unchanged.

1) Restrict nfnetlink_queue writes to the network header. Validate IP/IPv6
   headers and disable IPv6 extension header changes. Ensure total length
   matches skb length.

2) Restrict nft_payload writes to linklayer and network header data. Prevent
   linklayer writes from spilling into network headers. Validate network
   header updates to protect IP version and length fields.

3) add restrictions to the checksum offset, without this patch 2 isn't
   sufficient because an invalid checksum offset can e.g. overwrite iph
   header length field.

This doesn't remove the userns restriction, yet.
I would like to wait a bit before re-enabling this to make sure there
are no other gaps (e.g. for encapsulated traffic).

Florian Westphal (3):
  netfilter: nfnetlink_queue: restrict writes to network header
  netfilter: nftables: restrict linklayer and network header writes
  netfilter: nftables: restrict checkum update offset

 net/netfilter/nfnetlink_queue.c | 192 +++++++++++++++++++++++
 net/netfilter/nft_payload.c     | 270 ++++++++++++++++++++++++++++++++
 2 files changed, 462 insertions(+)

-- 
2.53.0




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds