blob: 1d4008a9cce81014d5a9d39aedb2550c1f20cd46 [file] [log] [blame]
From bippy-5f407fcff5a0 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: <linux-cve-announce@vger.kernel.org>
Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org>
Subject: CVE-2024-36971: net: fix __dst_negative_advice() race
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
net: fix __dst_negative_advice() race
__dst_negative_advice() does not enforce proper RCU rules when
sk->dst_cache must be cleared, leading to possible UAF.
RCU rules are that we must first clear sk->sk_dst_cache,
then call dst_release(old_dst).
Note that sk_dst_reset(sk) is implementing this protocol correctly,
while __dst_negative_advice() uses the wrong order.
Given that ip6_negative_advice() has special logic
against RTF_CACHE, this means each of the three ->negative_advice()
existing methods must perform the sk_dst_reset() themselves.
Note the check against NULL dst is centralized in
__dst_negative_advice(), there is no need to duplicate
it in various callbacks.
Many thanks to Clement Lecigne for tracking this issue.
This old bug became visible after the blamed commit, using UDP sockets.
The Linux kernel CVE team has assigned CVE-2024-36971 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.6 with commit a87cb3e48ee86d29868d3f59cfb9ce1a8fa63314 and fixed in 4.19.316 with commit 051c0bde9f0450a2ec3d62a86d2a0d2fad117f13
Issue introduced in 4.6 with commit a87cb3e48ee86d29868d3f59cfb9ce1a8fa63314 and fixed in 5.4.278 with commit db0082825037794c5dba9959c9de13ca34cc5e72
Issue introduced in 4.6 with commit a87cb3e48ee86d29868d3f59cfb9ce1a8fa63314 and fixed in 5.10.219 with commit 2295a7ef5c8c49241bff769e7826ef2582e532a6
Issue introduced in 4.6 with commit a87cb3e48ee86d29868d3f59cfb9ce1a8fa63314 and fixed in 5.15.161 with commit eacb8b195579c174a6d3e12a9690b206eb7f28cf
Issue introduced in 4.6 with commit a87cb3e48ee86d29868d3f59cfb9ce1a8fa63314 and fixed in 6.1.94 with commit 81dd3c82a456b0015461754be7cb2693991421b4
Issue introduced in 4.6 with commit a87cb3e48ee86d29868d3f59cfb9ce1a8fa63314 and fixed in 6.6.34 with commit 5af198c387128a9d2ddd620b0f0803564a4d4508
Issue introduced in 4.6 with commit a87cb3e48ee86d29868d3f59cfb9ce1a8fa63314 and fixed in 6.9.4 with commit b8af8e6118a6605f0e495a58d591ca94a85a50fc
Issue introduced in 4.6 with commit a87cb3e48ee86d29868d3f59cfb9ce1a8fa63314 and fixed in 6.10 with commit 92f1655aa2b2294d0b49925f3b875a634bd3b59e
Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to
older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2024-36971
will be updated if fixes are backported, please check that for the most
up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
include/net/dst_ops.h
include/net/sock.h
net/ipv4/route.c
net/ipv6/route.c
net/xfrm/xfrm_policy.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes. Individual
changes are never tested alone, but rather are part of a larger kernel
release. Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all. If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
https://git.kernel.org/stable/c/051c0bde9f0450a2ec3d62a86d2a0d2fad117f13
https://git.kernel.org/stable/c/db0082825037794c5dba9959c9de13ca34cc5e72
https://git.kernel.org/stable/c/2295a7ef5c8c49241bff769e7826ef2582e532a6
https://git.kernel.org/stable/c/eacb8b195579c174a6d3e12a9690b206eb7f28cf
https://git.kernel.org/stable/c/81dd3c82a456b0015461754be7cb2693991421b4
https://git.kernel.org/stable/c/5af198c387128a9d2ddd620b0f0803564a4d4508
https://git.kernel.org/stable/c/b8af8e6118a6605f0e495a58d591ca94a85a50fc
https://git.kernel.org/stable/c/92f1655aa2b2294d0b49925f3b875a634bd3b59e