From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, dsahern@kernel.org, horms@kernel.org,
willemdebruijn.kernel@gmail.com, aksecurity@gmail.com,
noam.caspi@mail.huji.ac.il, stable@vger.kernel.org
Subject: Re: [PATCH net v2 3/4] ipv6: udp: Create exceptions before socket matching
Date: Mon, 31 Aug 2026 09:45:11 +0300 [thread overview]
Message-ID: <20260831064511.GB3079008@shredder> (raw)
In-Reply-To: <20260828192344.2596928-4-idosch@nvidia.com>
On Fri, Aug 28, 2026 at 10:23:43PM +0300, Ido Schimmel wrote:
> Currently, when ICMPv6 Packet Too Big and Redirect Message packets are
> locally delivered and quote a UDP packet, an exception is only created
> in the IPv6 exception cache if the kernel can match the UDP packet to an
> existing socket.
>
> This behavior allows off-path attackers to conduct a side-channel attack
> on the exception cache in order to discover the ephemeral port used by a
> connected UDP socket.
>
> Commit 4785305c05b2 ("ipv6: use siphash in rt6_exception_hash()") and
> commit a00df2caffed ("ipv6: make exception cache less predictible") tried
> to mitigate such attacks by making it harder for attackers to discover
> hash collisions in the exception cache and by randomizing the number of
> exceptions a hash bucket can hold, respectively. Unfortunately, both of
> the mitigations can be bypassed.
>
> Instead, mitigate such attacks by always creating an exception, even
> before trying to find a matching socket. Do that by calling
> ip6_update_pmtu() and ip6_redirect(), the helpers used when the quoted
> packet did not originate from a socket.
>
> This means that guesses (right or wrong) from an off-path attacker will
> always result in an exception being created or updated in the cache that
> the attacker can observe.
>
> Pass the ifindex of the ingress device and the default uid, in a similar
> fashion to icmpv6_err(). Unlike IPv4, an oif of 0 would not match any
> nexthop in ip6_redirect_nh_match() and no exception would be created in
> response to a Redirect Message.
>
> Note that this does not allow attackers to create exceptions that they
> could not create before, as both helpers can already be reached with
> little to no validation. For example, by sending an ICMPv6 error that
> quotes an ICMPv6 Echo Reply or one that quotes a UDP source port that
> matches a wildcard socket.
>
> Also note that in the good case (matched socket) the above scheme comes
> at the cost of an extra route lookup, as the no socket helpers perform
> their own lookup before the one performed by ip6_sk_update_pmtu() /
> ip6_sk_redirect(). When the two resolve to different nexthops, it also
> results in two exceptions being created for the same destination IP. One
> in the exception cache of the nexthop resolved by the no socket helpers
> and another in the exception cache of the nexthop used by the socket.
tl;dr - Same as patch 2. No changes following the feedback from Sashiko.
"Can the Packet Too Big path still leave the guess/no-guess difference
visible when the two lookups resolve to different nexthops?"
No. The side channel only exists if the attacker can populate the
exception cache of the nexthop used by the socket.
next prev parent reply other threads:[~2026-08-31 6:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 19:23 [PATCH net v2 0/4] Mitigate a side channel in routing exception caches Ido Schimmel
2026-08-28 19:23 ` [PATCH net v2 1/4] ipv6: Fix redirect exception creation for UDP/RAW sockets Ido Schimmel
2026-08-28 19:23 ` [PATCH net v2 2/4] ipv4: udp: Create exceptions before socket matching Ido Schimmel
2026-08-28 19:44 ` David Ahern
2026-08-31 6:44 ` Ido Schimmel
2026-08-28 19:23 ` [PATCH net v2 3/4] ipv6: " Ido Schimmel
2026-08-28 19:44 ` David Ahern
2026-08-31 6:45 ` Ido Schimmel [this message]
2026-08-28 19:23 ` [PATCH net v2 4/4] selftests: net: Add exception cache tests Ido Schimmel
2026-08-31 6:59 ` Ido Schimmel
2026-09-01 3:10 ` [PATCH net v2 0/4] Mitigate a side channel in routing exception caches 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=20260831064511.GB3079008@shredder \
--to=idosch@nvidia.com \
--cc=aksecurity@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=noam.caspi@mail.huji.ac.il \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.