linux/net
Eric Dumazet 2ee66e9487 inetpeer: randomize RB-tree node comparison using SipHash
The inetpeer rate limiting system stores peer entries in a Red-Black tree
keyed deterministically on the remote IP address. Because tree lookups walk
the RB-tree using standard lexicographical comparisons (inetpeer_addr_cmp),
an off-path adversary can predict the exact topology of the tree and the
sequence of nodes traversed during lookups (the gc_stack candidate list).

By combining deterministic tree traversal with aggressive garbage collection
(triggered when tree size exceeds inet_peer_threshold), an attacker can
selectively force the eviction of targeted inet_peer nodes. When an evicted
node is subsequently re-created upon receiving a new packet, its rate-limiting
token bucket (rate_tokens, rate_last) is reset to full capacity. This creates
a side-channel primitive allowing off-path attackers to bypass IP-keyed ICMP
rate limits and infer open UDP ports (similar to SAD DNS style attacks).

Mitigate this by randomizing the RB-tree node comparison logic using SipHash
with a secret key (inetpeer_hash_key) initialized via net_get_random_once().
Nodes are ordered in the tree by SipHash(addr, key) rather than raw IP
addresses. Because the secret key is unknown to external entities, the tree
layout and lookup traversal paths are unpredictable to off-path adversaries,
breaking the deterministic eviction gadget.

Cache the computed 64-bit SipHash (hash) in struct inet_peer and compute the
target hash (dhash) once at the beginning of inet_getpeer() to avoid recomputing
SipHash at every step of the RB-tree walk.

Fixes: b145425f26 ("inetpeer: remove AVL implementation in favor of RB tree")
Reported-by: Michael Blunt <michaelbblunt@gmail.com>
Suggested-by: Michael Blunt <michaelbblunt@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260818151213.3953963-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-20 12:55:31 -07:00
..
6lowpan net: Use helpers to get/set UDP len tree-wide 2026-07-22 13:47:02 +02:00
9p 9p: Add missing read barrier in virtio zero-copy path 2026-06-21 05:22:57 +00:00
802 appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
8021q vlan: defer real device state propagation to netdev_work 2026-06-25 10:18:40 -07:00
atm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-06 11:53:47 -07:00
batman-adv batman-adv: remove negative returns for batadv_send_skb_unicast 2026-08-05 10:00:16 +02:00
bluetooth Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
bpf bpf: Fix partial copy of non-linear test_run output 2026-06-21 17:55:06 -07:00
bridge net: bridge: Reject descending VLAN tunnel ranges 2026-08-20 11:32:44 -07:00
can can: isotp: check register_netdevice_notifier() error in module init 2026-07-29 11:26:41 +02:00
ceph libceph: Avoid using invalid osd indices from primary_temp 2026-08-12 21:21:41 +02:00
core net: add missing ref_tracker_dir_exit() to net_passive_dec() 2026-08-20 12:44:12 -07:00
dcb
devlink devlink: add generic device max_sfs parameter 2026-08-11 18:06:30 -07:00
dns_resolver keys, dns: Drop unused NUL terminator from upayload->data 2026-08-10 16:20:42 -07:00
dsa net: dsa: initial MT7628 tagging driver 2026-08-18 15:50:13 +02:00
ethernet
ethtool ethtool: tsconfig: reject zero-valued tx_type and rx_filter bitsets 2026-08-13 17:44:54 -07:00
handshake handshake: Require admin permission for DONE command 2026-06-12 15:45:44 -07:00
hsr Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-18 10:42:41 -07:00
ieee802154 ieee802154: convert dgram getsockopt to sockopt_t 2026-08-03 16:55:23 -07:00
ife net: ife: require ETH_HLEN to be pullable in ife_decode() 2026-06-13 17:34:39 -07:00
ipv4 inetpeer: randomize RB-tree node comparison using SipHash 2026-08-20 12:55:31 -07:00
ipv6 ip6mr: do not clone dst in ip6mr_cache_report() 2026-08-20 12:54:29 -07:00
iucv net/af_iucv: fix NULL deref in afiucv_hs_callback_syn() 2026-07-21 13:36:35 -07:00
kcm net: kcm: Hold RCU read lock while running BPF parser 2026-08-17 13:43:58 -07:00
key ipsec-2026-06-22 2026-06-23 16:22:24 -07:00
l2tp l2tp: send netlink notifications in the tunnel's net namespace 2026-08-13 17:33:31 -07:00
l3mdev
lapb
llc llc: fix SAP refcount leak when creating incoming sockets 2026-07-17 13:17:46 +02:00
mac80211 Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
mac802154 mac802154: fix netdev use-after-free in beacon worker 2026-08-05 17:12:50 -07:00
mctp net: mctp: hold a reference to the route device in mctp_route_lookup() 2026-08-20 12:27:40 -07:00
mpls mpls: reload header after pskb_may_pull() 2026-08-18 10:51:37 +02:00
mptcp mptcp: fix uninitialized local_id in syncookie MP_JOIN reconstruction 2026-08-20 12:53:14 -07:00
ncsi net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length 2026-08-05 17:24:57 -07:00
netfilter ipvs: fix integer overflow in ftp helper port/address parsing 2026-08-18 00:56:43 +02:00
netlabel Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-06-11 14:33:35 -07:00
netlink netlink: drop unneeded semicolon 2026-08-05 17:32:34 -07:00
nfc nfc: nci: free destination parameters when closing a connection 2026-08-11 18:10:04 +02:00
nsh
openvswitch Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-18 10:42:41 -07:00
packet af_packet: Don't send zero-byte data in tpacket_snd(). 2026-08-11 17:32:53 -07:00
phonet phonet: pep: convert getsockopt to sockopt_t 2026-08-03 16:55:23 -07:00
psample net: psample: fix info leak in PSAMPLE_ATTR_DATA 2026-06-17 16:35:50 -07:00
psp psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev 2026-08-17 11:06:14 -07:00
qrtr net: qrtr: ns: Raise lookup limit to 128 2026-08-06 08:10:44 -07:00
rds net/rds: clear i_rx_lat_trace in rds_inc_path_init() 2026-08-13 12:53:14 +02:00
rfkill Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
rxrpc rxrpc: fix io_thread race in rxrpc_wake_up_io_thread() 2026-07-21 11:52:29 +02:00
sched net/sched: add get_fill_size callbacks for actions missing them 2026-08-20 12:16:43 -07:00
sctp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-18 10:42:41 -07:00
shaper net: shaper: add a note that we expect cap dumps to be tiny 2026-06-11 12:55:23 +02:00
smc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-18 10:42:41 -07:00
strparser
sunrpc SUNRPC: pin upper rpc_clnt across the TLS connect_worker 2026-07-08 14:07:19 -04:00
switchdev
tipc tipc: read le->link under the node lock in tipc_node_link_down() 2026-08-11 15:50:22 +02:00
tls Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-18 10:42:41 -07:00
unix Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
vmw_vsock Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-18 10:42:41 -07:00
wireless Quite a bunch more work, of note: 2026-08-06 12:39:11 -07:00
x25 net/x25: fix use-after-free of the socket by its timers 2026-07-30 18:46:45 -07:00
xdp xsk: fix NULL pointer dereference in __xsk_rcv() 2026-08-20 11:31:35 -07:00
xfrm ipsec-2026-08-18 2026-08-20 11:38:14 -07:00
compat.c net: af_unix: useful handling of LSM denials on SCM_RIGHTS 2026-08-17 18:14:52 -07:00
devres.c
Kconfig appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
Kconfig.debug
Makefile appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
socket.c Major changes: 2026-08-20 07:36:20 -07:00
sysctl_net.c net: enforce net sysctl registration 2026-08-13 13:12:21 +02:00