From: Pablo Neira Ayuso <pablo@netfilter•org>
To: Michael Bommarito <michael.bommarito@gmail•com>
Cc: Steffen Klassert <steffen.klassert@secunet•com>,
Herbert Xu <herbert@gondor•apana.org.au>,
Eric Dumazet <edumazet@google•com>,
netdev@vger•kernel.org, "David S . Miller" <davem@davemloft•net>,
Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
Kuniyuki Iwashima <kuniyu@google•com>,
Maciej Zenczykowski <maze@google•com>,
Kees Cook <kees@kernel•org>, Jeff Layton <jlayton@kernel•org>,
"Gustavo A . R . Silva" <gustavoars@kernel•org>,
Florian Westphal <fw@strlen•de>,
netfilter-devel@vger•kernel.org, coreteam@netfilter•org,
linux-kernel@vger•kernel.org
Subject: Re: [PATCH net 0/2] ipv4: harden against ihl < 5 IP_HDRINCL packets
Date: Wed, 13 May 2026 00:34:50 +0200 [thread overview]
Message-ID: <agOrCj3YoMAxsxYf@chamomile> (raw)
In-Reply-To: <cover.1778614451.git.michael.bommarito@gmail.com>
On Tue, May 12, 2026 at 04:51:13PM -0400, Michael Bommarito wrote:
[...]
> Open question for netfilter / netdev
> ------------------------------------
>
> After patch 1/2 lands, a caller with CAP_NET_ADMIN can still
> deliver an ihl < 5 packet into the post-LOCAL_OUT in-stack path by
> attaching an nftables payload-set rule on NF_INET_LOCAL_OUT (or an
> NFQUEUE reinject on the same hook) that rewrites byte 0 of the
> IPv4 header after the raw_send_hdrinc / __ip_local_out validation
> has run.
There are possibly more ways to mangle ihl in the kernel in 2026, not
only NFQUEUE and nft_payload.
> Construction:
>
> nft add table ip mangle
> nft add chain ip mangle output { type filter hook output \
> priority -150 \; }
> nft add rule ip mangle output ip daddr <victim> \
> @nh,0,8 set 0x40
>
> I reproduced this separately with nftables payload-set delivering an
> ihl = 0 packet to xfrm4_output() and onward. Patch 2/2 covers the
> AH consumer; other consumers that read iph->ihl after the LOCAL_OUT
> hook may be similarly exposed and I have not enumerated them.
>
> Direction question rather than a fix proposal: does basic iphdr
> re-sanitization after a header-mangling hook belong in the netfilter
> machinery, in each in-stack consumer, or both?
Your patches LGTM, are you suggesting more patches?
next prev parent reply other threads:[~2026-05-12 22:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 20:51 [PATCH net 0/2] ipv4: harden against ihl < 5 IP_HDRINCL packets Michael Bommarito
2026-05-12 20:51 ` [PATCH net 1/2] ipv4: raw: reject IP_HDRINCL packets with ihl < 5 Michael Bommarito
2026-05-12 20:51 ` [PATCH net 2/2] ipv4: ah: harden ah_output options-copy guard against " Michael Bommarito
2026-05-15 4:20 ` Herbert Xu
2026-05-17 23:49 ` [PATCH net] xfrm: validate IPv4 header length before output transforms Michael Bommarito
2026-05-12 22:34 ` Pablo Neira Ayuso [this message]
2026-05-12 23:05 ` [PATCH net 0/2] ipv4: harden against ihl < 5 IP_HDRINCL packets Michael Bommarito
2026-05-15 4:22 ` Herbert Xu
2026-05-15 22:59 ` Jakub Kicinski
2026-05-15 23:00 ` patchwork-bot+netdevbpf
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=agOrCj3YoMAxsxYf@chamomile \
--to=pablo@netfilter$(echo .)org \
--cc=coreteam@netfilter$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=fw@strlen$(echo .)de \
--cc=gustavoars@kernel$(echo .)org \
--cc=herbert@gondor$(echo .)apana.org.au \
--cc=jlayton@kernel$(echo .)org \
--cc=kees@kernel$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=kuniyu@google$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=maze@google$(echo .)com \
--cc=michael.bommarito@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=netfilter-devel@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=steffen.klassert@secunet$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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