Thread (8 messages) flat view 8 messages, 2 authors, 4d ago

Re: [PATCH net 2/4] ipv4: udp: Create exceptions when socket matching failed

From: Eric Dumazet <edumazet@google.com>
Date: 2026-08-26 15:51:07
Also in: stable

On Wed, Aug 26, 2026 at 4:39 PM Ido Schimmel [off-list ref] wrote:
Currently, when ICMP Fragmentation Needed and Redirect Message packets
are locally delivered and quote a UDP packet, a FIB nexthop exception
(FNHE) is created only 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 FNHE cache in order to discover the ephemeral port used by a
connected UDP socket.

Commit 6457378fe796 ("ipv4: use siphash instead of Jenkins in
fnhe_hashfun()") and commit 67d6d681e15b ("ipv4: make exception cache
less predictible") tried to mitigate such attacks by making it harder
for attackers to discover hash collisions in the FNHE 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 a FNHE, even if socket
matching failed. Do that by calling ipv4_update_pmtu() and
ipv4_redirect(), the helpers used when the quoted packet did not
originate from a socket. The resulting FNHE is indistinguishable from
the one created when socket matching succeeded, both in terms of cache
occupancy and in terms of its contents.

Pass an oif of 0, in a similar fashion to icmp_err().

Note that this does not allow attackers to create FNHEs that they could
not create before, as both helpers can already be reached with little to
no validation. For example, by sending an ICMP error that quotes an ICMP
Echo Reply or one that quotes a UDP source port that matches a wildcard
socket.

Also create a FNHE when a socket does not wish to accept PMTU updates
(e.g., by setting 'IP_PMTUDISC_OMIT'). Otherwise, the fact that a FNHE
was not created can indicate to an off-path attacker that a socket
exists. This applies to all ipv4_sk_update_pmtu() callers, so ping and
raw sockets that decline PMTU updates will now create a FNHE as well.
Such sockets are not affected by it, as ip_skb_dst_mtu() uses the MTU of
the device for them.

Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.")
Cc: stable@vger.kernel.org
Reported-by: Amit Klein <redacted>
Reported-by: Noam Caspi <redacted>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help