public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Justin Iurman <justin.iurman@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Tom Herbert <tom@herbertland.com>,
	davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v5 6/7] ipv6: Enforce Extension Header ordering
Date: Thu, 29 Jan 2026 21:13:02 +0100	[thread overview]
Message-ID: <2745371a-8ea2-44c3-9238-93560fcdbb77@gmail.com> (raw)
In-Reply-To: <willemdebruijn.kernel.8e46b721f5ed@gmail.com>

On 1/29/26 20:05, Willem de Bruijn wrote:
> Justin Iurman wrote:
>> On 1/29/26 06:18, Willem de Bruijn wrote:
>>> Tom Herbert wrote:
>>>> RFC8200 highly recommends that different Extension Headers be send in
>>>> a prescibed order and all Extension Header types occur at most once
>>>> in a packet with the exception of Destination Options that may
>>>> occur twice. This patch enforces the ordering be folowed in received
>>>> packets.
>>>>
>>>> The allowed order of Extension Headers is:
>>>>
>>>>       IPv6 header
>>>>       Hop-by-Hop Options header
>>>>       Destination Options before the Routing Header
>>>>       Routing header
>>>>       Fragment header
>>>>       Authentication header
>>>>       Encapsulating Security Payload header
>>>>       Destination Options header
>>>>       Upper-Layer header
>>>>
>>>> Each Extension Header may be present only once in a packet.
>>>>
>>>> net.ipv6.enforce_ext_hdr_order is a sysctl to enable or disable
>>>> enforcement of xtension Header order. If it is set to zero then
>>>
>>> [e]xtension. There are a few more typos in the various commit
>>> messages.
>>>
>>>> Extension Header order and number of occurences is not checked
>>>> in receive processeing (except for Hop-by-Hop Options that
>>>> must be the first Extension Header and can only occur once in
>>>> a packet.
>>>
>>> RFC 8200 also states
>>>
>>>      "IPv6 nodes must accept and attempt to process extension headers in
>>>      any order and occurring any number of times in the same packet,
>>>      except for the Hop-by-Hop Options header, which is restricted to
>>>      appear immediately after an IPv6 header only. Nonetheless, it is
>>>      strongly advised that sources of IPv6 packets adhere to the above
>>>      recommended order until and unless subsequent specifications revise
>>>      that recommendation."
>>>
>>> A case of be strict in what you send, liberal in what you accept.
>>>
>>> This new sysctl has a chance of breaking existing users.
>>
>> Willem,
>>
>> Note that RFC8200 does not use normative language, which is part of the
>> problem. It could theoretically break existing users, but I don't think
>> it will in reality. For that, you would need users to beginning with
>> (joke aside, I like EHs). Anyway, if the order is enforced at sending,
>> why would any receiver accept a different order? In this case, being
>> liberal in what we accept might be a security risk (see below).
>>
>>> The series as a whole is framed as a security improvement. Does
>>> enforcing order help with that?
>>
>> IMHO, any packet with EHs in a different order than the one specified in
>> RFC8200 looks suspicious. So, yes.
> 
> Looks suspicious. But does not introduce concrete new risks?
> 
> The main risk I understand around IPv6 extension headers is the risk
> common to all untrusted network input: bugs in parsing code. Bugs can
> cause crashes, infinite loops, or worse subtle effects. This is why we
> introduced the BPF flow dissector, for instance.
> 
> I don't immediately see how different order of headers increases
> parsing risk. Nor, btw, that reducing max number of headers from 8 to
> 2 significantly mitigates a real risk.
> 
> No objections necessarily. But I don't fully understand the argument.

Enforcing the order kills two birds with one stone as it also allows to 
automatically limit the number of DestOpts in general. This is a gap 
introduced by RFC8200, where you "must" accept EHs in any order and 
occurring any number of times in the same packet (even though it says 
that there might be two DestOpts max). The wording is ambiguous and 
non-normative. Since the DestOpt can contain a certain amount of 
options, then you theoretically end up with a nice attack vector.

Regarding why "reducing max number of headers from 8 to 2 significantly 
mitigates a real risk", it's not about the number of EHs, here this is 
about the number of options inside a Hop-by-Hop or Destination Option 
header specifically. Therefore, you further reduce the attack vector.

  reply	other threads:[~2026-01-29 20:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26 19:48 [PATCH net-next v5 0/7] ipv6: Address ext hdr DoS vulnerabilities Tom Herbert
2026-01-26 19:48 ` [PATCH net-next v5 1/7] ipv6: Check of max HBH or DestOp sysctl is zero and drop if it is Tom Herbert
2026-01-27 17:49   ` Justin Iurman
2026-01-27 17:50   ` Justin Iurman
2026-01-26 19:48 ` [PATCH net-next v5 2/7] ipv6: Cleanup IPv6 TLV definitions Tom Herbert
2026-01-27 17:51   ` Justin Iurman
2026-01-29  5:30   ` Willem de Bruijn
2026-01-29 18:13     ` Justin Iurman
2026-01-29 19:01       ` Willem de Bruijn
2026-01-30 17:22       ` Tom Herbert
2026-02-01  8:48         ` Justin Iurman
2026-02-02 22:37           ` Tom Herbert
2026-01-26 19:48 ` [PATCH net-next v5 3/7] ipv6: Add case for IPV6_TLV_TNL_ENCAP_LIMIT in EH TLV switch Tom Herbert
2026-01-27 17:52   ` Justin Iurman
2026-01-29  5:31   ` Willem de Bruijn
2026-01-26 19:48 ` [PATCH net-next v5 4/7] ipv6: Set HBH and DestOpt limits to 2 Tom Herbert
2026-01-27 17:55   ` Justin Iurman
2026-01-26 19:48 ` [PATCH net-next v5 5/7] ipv6: Document defaults for max_{dst|hbh}_opts_number sysctls Tom Herbert
2026-01-27 17:57   ` Justin Iurman
2026-01-26 19:48 ` [PATCH net-next v5 6/7] ipv6: Enforce Extension Header ordering Tom Herbert
2026-01-27 19:48   ` Justin Iurman
2026-01-29  5:18   ` Willem de Bruijn
2026-01-29 18:07     ` Justin Iurman
2026-01-29 19:05       ` Willem de Bruijn
2026-01-29 20:13         ` Justin Iurman [this message]
2026-01-30 17:06         ` Tom Herbert
2026-01-31 17:24           ` Willem de Bruijn
2026-02-02 22:21             ` Tom Herbert
2026-01-26 19:48 ` [PATCH net-next v5 7/7] ipv6: Document enforce_ext_hdr_order sysctl Tom Herbert
2026-01-27 18:00   ` Justin Iurman

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=2745371a-8ea2-44c3-9238-93560fcdbb77@gmail.com \
    --to=justin.iurman@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /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