CRITICAL
mptcp IPv6 Subflow UAF
CVE-2026-31669
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
KernelScan AI9.8CRITICAL
01Description
In the Linux kernel, the following vulnerability has been resolved: mptcp: fix slab-use-after-free in __inet_lookup_established The ehash table lookups are lockless and rely on SLAB_TYPESAFE_BY_RCU to guarantee socket memory stability during RCU read-side critical sections. Both tcp_prot and tcpv6_prot have their slab caches created with this flag via proto_register(). However, MPTCP's mptcp_subflow_init() copies tcpv6_prot into tcpv6_prot_override during inet_init() (fs_initcall, level 5), before inet6_init() (module_init/device_initcall, level 6) has called proto_register(&tcpv6_prot). At that point, tcpv6_prot.slab is still NULL, so tcpv6_prot_override.slab remains NULL permanently. This causes MPTCP v6 subflow child sockets to be allocated via kmalloc (falling into kmalloc-4k) instead of the TCPv6 slab cache. The kmalloc-4k cache lacks SLAB_TYPESAFE_BY_RCU, so when these sockets are freed without SOCK_RCU_FREE (which is cleared for child sockets by design), the memory can be immediately reused. Concurrent ehash lookups under rcu_read_lock can then access freed memory, triggering a slab-use-after-free in __inet_lookup_established. Fix this by splitting the IPv6-specific initialization out of mptcp_subflow_init() into a new mptcp_subflow_v6_init(), called from mptcp_proto_v6_init() before protocol registration. This ensures tcpv6_prot_override.slab correctly inherits the SLAB_TYPESAFE_BY_RCU slab cache.
02KernelScan AI Analysis
Risk summary
Critical memory corruption vulnerability in MPTCP IPv6 that can cause kernel crashes or potential code execution. When MPTCP IPv6 connections are active, freed socket memory can be accessed by concurrent network operations, leading to unpredictable system behavior. The issue affects any system with MPTCP IPv6 enabled and can be triggered remotely through network traffic.
Vulnerability analysis
Root Cause: MPTCP's initialization order bug causes IPv6 subflow sockets to be allocated without SLAB_TYPESAFE_BY_RCU protection. The mptcp_subflow_init() function copies tcpv6_prot into tcpv6_prot_override during inet_init() (level 5), before inet6_init() (level 6) has called proto_register(&tcpv6_prot). At copy time, tcpv6_prot.slab is NULL, so tcpv6_prot_override.slab remains NULL permanently.
Attack Surface: Network-accessible MPTCP IPv6 connections. The vulnerability occurs during concurrent ehash table lookups while MPTCP v6 subflow child sockets are being freed. Since child sockets lack SOCK_RCU_FREE protection and are allocated via kmalloc-4k (without SLAB_TYPESAFE_BY_RCU), freed memory can be immediately reused, leading to use-after-free in __inet_lookup_established during lockless ehash lookups under rcu_read_lock.
Fix Mechanism: The patch splits IPv6-specific initialization into a separate mptcp_subflow_v6_init() function called from mptcp_proto_v6_init() before protocol registration. This ensures tcpv6_prot_override.slab correctly inherits the SLAB_TYPESAFE_BY_RCU slab cache after tcpv6_prot has been properly initialized.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 5.15 | 5.15.203 | f6e1f25fa5e7 |
| 6.1 | 6.1.169 | fb1f54b7d16f |
| 6.12 | 6.12.82 | eb9c6aeb512f |
| 6.18 | 6.18.23 | 15fa9ead4d5e |
| 6.19 | 6.19.13 | b313e9037d98 |
| 6.6 | 6.6.135 | 3fd6547f5b8a |
| mainline | 7.0 | 9b55b253907e |