Netdev List
 help / color / mirror / Atom feed
* [PATCH net 0/4] Mitigate a side channel in routing exception caches
@ 2026-08-26 14:37 Ido Schimmel
  2026-08-26 14:37 ` [PATCH net 1/4] ipv6: Fix redirect exception creation for UDP/RAW sockets Ido Schimmel
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ido Schimmel @ 2026-08-26 14:37 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, pabeni, edumazet, dsahern, horms,
	willemdebruijn.kernel, aksecurity, noam.caspi, Ido Schimmel

When an ICMP error that quotes a UDP packet is locally delivered, the
kernel only creates a routing exception if the quoted packet matches a
socket. This allows an off-path attacker to conduct a side-channel
attack on the routing exception caches in order to discover the
ephemeral ports used by connected UDP sockets.

Previous mitigations tried to make it harder for attackers to find hash
collisions in these caches and make the eviction of exceptions less
predictable. Amit Klein and Noam Caspi demonstrated that both of these
mitigations can be bypassed.

This patchset tries to mitigate such attacks by always creating an
exception, even if UDP socket matching failed. The exception is created
by the same helpers that are used when the quoted packet did not
originate from a socket, so that neither the occupancy of the cache nor
the contents of the exception are indicative of the success or failure
of UDP socket matching.

Note that this mitigation does not make it easier for attackers to fill
these caches, since they can already create exceptions 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.

Patch #1 fixes a pre-existing bug in the handling of ICMPv6 Redirect
Message packets. Discovered while writing the selftest.

Patch #2 creates an exception from the IPv4 UDP code when socket
matching failed. Other socket types do not need this: raw sockets have
no ports, and for TCP the ICMP error is discarded unless the quoted
sequence number is in window.

Patch #3 does the same for IPv6.

Patch #4 adds a selftest.

Ido Schimmel (4):
  ipv6: Fix redirect exception creation for UDP/RAW sockets
  ipv4: udp: Create exceptions when socket matching failed
  ipv6: udp: Create exceptions when socket matching failed
  selftests: net: Add exception cache tests

 net/ipv4/route.c                              |   8 +-
 net/ipv4/udp.c                                |  10 +
 net/ipv6/route.c                              |   2 +-
 net/ipv6/udp.c                                |  17 +-
 tools/testing/selftests/net/Makefile          |   1 +
 .../testing/selftests/net/exception_cache.sh  | 501 ++++++++++++++++++
 6 files changed, 534 insertions(+), 5 deletions(-)
 create mode 100755 tools/testing/selftests/net/exception_cache.sh

-- 
2.55.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-08-27 19:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26 14:37 [PATCH net 0/4] Mitigate a side channel in routing exception caches Ido Schimmel
2026-08-26 14:37 ` [PATCH net 1/4] ipv6: Fix redirect exception creation for UDP/RAW sockets Ido Schimmel
2026-08-26 14:37 ` [PATCH net 2/4] ipv4: udp: Create exceptions when socket matching failed Ido Schimmel
2026-08-26 15:50   ` Eric Dumazet
2026-08-27 19:33   ` Ido Schimmel
2026-08-26 14:37 ` [PATCH net 3/4] ipv6: " Ido Schimmel
2026-08-26 15:51   ` Eric Dumazet
2026-08-26 14:37 ` [PATCH net 4/4] selftests: net: Add exception cache tests Ido Schimmel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox