UBUNTU-CVE-2024-56644
In the Linux kernel, the following vulnerability has been resolved: net/ipv6: release expired exception dst cached in socket Dst objects get leaked in ip6_negative_advice() when this function is executed for an expired IPv6 route located in the exception table. There are several conditions that must be fulfilled for the leak to occur: * an ICMPv6 packet indicating a change of the MTU for the path is received, resulting in an exception dst being created * a TCP connection that uses the exception dst for routing packets must start timing out so that TCP begins retransmissions * after the exception dst expires, the FIB6 garbage collector must not run before TCP executes ip6_negative_advice() for the expired exception dst When TCP executes ip6_negative_advice() for an exception dst that has expired and if no other socket holds a reference to the exception dst, the refcount of the exception dst is 2, which corresponds to the increment made by dst_init() and the increment made by the TCP socket for which the connection is timing out. The refcount made by the socket is never released. The refcount of the dst is decremented in sk_dst_reset() but that decrement is counteracted by a dst_hold() intentionally placed just before the sk_dst_reset() in ip6_negative_advice(). After ip6_negative_advice() has finished, there is no other object tied to the dst. The socket lost its reference stored in sk_dst_cache and the dst is no longer in the exception table. The exception dst becomes a leaked object. As a result of this dst leak, an unbalanced refcount is reported for the loopback device of a net namespace being destroyed under kernels that do not contain e5f80fcf869a ("ipv6: give an IPv6 dev to blackhole_netdev"): unregister_netdevice: waiting for lo to become free. Usage count = 2 Fix the dst leak by removing the dst_hold() in ip6_negative_advice(). The patch that introduced the dst_hold() in ip6_negative_advice() was 92f1655aa2b22 ("net: fix __dst_negative_advice() race"). But 92f1655aa2b22 merely refactored the code with regards to the dst refcount so the issue was present even before 92f1655aa2b22. The bug was introduced in 54c1a859efd9f ("ipv6: Don't drop cache route entry unless timer actually expired.") where the expired cached route is deleted and the sk_dst_cache member of the socket is set to NULL by calling dst_negative_advice() but the refcount belonging to the socket is left unbalanced. The IPv4 version - ipv4_negative_advice() - is not affected by this bug. When the TCP connection times out ipv4_negative_advice() merely resets the sk_dst_cache of the socket while decrementing the refcount of the exception dst.
02 / AFFECTED SOFTWARE
Affected packages
33 explicit affected versions
23 explicit affected versions
10 explicit affected versions
66 explicit affected versions
15 explicit affected versions
16 explicit affected versions
11 explicit affected versions
43 explicit affected versions
59 explicit affected versions
1 explicit affected versions
87 explicit affected versions
61 explicit affected versions
16 explicit affected versions
100 explicit affected versions
120 explicit affected versions
50 explicit affected versions
6 explicit affected versions
12 explicit affected versions
19 explicit affected versions
6 explicit affected versions
69 explicit affected versions
21 explicit affected versions
54 explicit affected versions
72 explicit affected versions
62 explicit affected versions
55 explicit affected versions
10 explicit affected versions
12 explicit affected versions
19 explicit affected versions
61 explicit affected versions
191 explicit affected versions
7 explicit affected versions
60 explicit affected versions
16 explicit affected versions
100 explicit affected versions
13 explicit affected versions
85 explicit affected versions
18 explicit affected versions
35 explicit affected versions
21 explicit affected versions
19 explicit affected versions
18 explicit affected versions
20 explicit affected versions
118 explicit affected versions
64 explicit affected versions
21 explicit affected versions
102 explicit affected versions
13 explicit affected versions
4 explicit affected versions
121 explicit affected versions
23 explicit affected versions
26 explicit affected versions
1 explicit affected versions
1 explicit affected versions
21 explicit affected versions
16 explicit affected versions
10 explicit affected versions
57 explicit affected versions
22 explicit affected versions
2 explicit affected versions
7 explicit affected versions
12 explicit affected versions
111 explicit affected versions
1 explicit affected versions
52 explicit affected versions
12 explicit affected versions
14 explicit affected versions
15 explicit affected versions
13 explicit affected versions
8 explicit affected versions
7 explicit affected versions
10 explicit affected versions
37 explicit affected versions
2 explicit affected versions
89 explicit affected versions
12 explicit affected versions
1 explicit affected versions
13 explicit affected versions
14 explicit affected versions
10 explicit affected versions
1 explicit affected versions
37 explicit affected versions
26 explicit affected versions
13 explicit affected versions
144 explicit affected versions
12 explicit affected versions
1 explicit affected versions
29 explicit affected versions
93 explicit affected versions
13 explicit affected versions
105 explicit affected versions
24 explicit affected versions
105 explicit affected versions
113 explicit affected versions
12 explicit affected versions
1 explicit affected versions
188 explicit affected versions
11 explicit affected versions
12 explicit affected versions
7 explicit affected versions
12 explicit affected versions
103 explicit affected versions
138 explicit affected versions
2 explicit affected versions
52 explicit affected versions
46 explicit affected versions
132 explicit affected versions
62 explicit affected versions
165 explicit affected versions
154 explicit affected versions
10 explicit affected versions
26 explicit affected versions
20 explicit affected versions
38 explicit affected versions
1 explicit affected versions
11 explicit affected versions
23 explicit affected versions
13 explicit affected versions
21 explicit affected versions
139 explicit affected versions
63 explicit affected versions
16 explicit affected versions
63 explicit affected versions
24 explicit affected versions
53 explicit affected versions
116 explicit affected versions
3 explicit affected versions
93 explicit affected versions
1 explicit affected versions
1 explicit affected versions
2 explicit affected versions
70 explicit affected versions
51 explicit affected versions
92 explicit affected versions
9 explicit affected versions
20 explicit affected versions
12 explicit affected versions
49 explicit affected versions
27 explicit affected versions
36 explicit affected versions
1 explicit affected versions
1 explicit affected versions
98 explicit affected versions
17 explicit affected versions
8 explicit affected versions
26 explicit affected versions
5 explicit affected versions
8 explicit affected versions
1 explicit affected versions
10 explicit affected versions
20 explicit affected versions
13 explicit affected versions
92 explicit affected versions
13 explicit affected versions
56 explicit affected versions
7 explicit affected versions
140 explicit affected versions
2 explicit affected versions
94 explicit affected versions
54 explicit affected versions
10 explicit affected versions
12 explicit affected versions
15 explicit affected versions
91 explicit affected versions
44 explicit affected versions
16 explicit affected versions
3 explicit affected versions
13 explicit affected versions
26 explicit affected versions
45 explicit affected versions
37 explicit affected versions
25 explicit affected versions
14 explicit affected versions
38 explicit affected versions
167 explicit affected versions
53 explicit affected versions
9 explicit affected versions
51 explicit affected versions
11 explicit affected versions
15 explicit affected versions
7 explicit affected versions
62 explicit affected versions
7 explicit affected versions
33 explicit affected versions
97 explicit affected versions
64 explicit affected versions
121 explicit affected versions
4 explicit affected versions
1 explicit affected versions
1 explicit affected versions
1 explicit affected versions
60 explicit affected versions
13 explicit affected versions
43 explicit affected versions
58 explicit affected versions
10 explicit affected versions
8 explicit affected versions
19 explicit affected versions
14 explicit affected versions
92 explicit affected versions
4 explicit affected versions
78 explicit affected versions
11 explicit affected versions
1 explicit affected versions
69 explicit affected versions
14 explicit affected versions
03 / CONNECTIONS
Connected vulnerabilities
04 / EVIDENCE
Source records
In the Linux kernel, the following vulnerability has been resolved: net/ipv6: release expired exception dst cached in socket Dst objects get leaked in ip6_negative_advice() when this function is executed for an expired IPv6 route located in the exception table. There are several conditions that must be fulfilled for the leak to occur: * an ICMPv6 packet indicating a change of the MTU for the path is received, resulting in an exception dst being created * a TCP connection that uses the exception dst for routing packets must start timing out so that TCP begins retransmissions * after the exception dst expires, the FIB6 garbage collector must not run before TCP executes ip6_negative_advice() for the expired exception dst When TCP executes ip6_negative_advice() for an exception dst that has expired and if no other socket holds a reference to the exception dst, the refcount of the exception dst is 2, which corresponds to the increment made by dst_init() and the increment made by the TCP socket for which the connection is timing out. The refcount made by the socket is never released. The refcount of the dst is decremented in sk_dst_reset() but that decrement is counteracted by a dst_hold() intentionally placed just before the sk_dst_reset() in ip6_negative_advice(). After ip6_negative_advice() has finished, there is no other object tied to the dst. The socket lost its reference stored in sk_dst_cache and the dst is no longer in the exception table. The exception dst becomes a leaked object. As a result of this dst leak, an unbalanced refcount is reported for the loopback device of a net namespace being destroyed under kernels that do not contain e5f80fcf869a ("ipv6: give an IPv6 dev to blackhole_netdev"): unregister_netdevice: waiting for lo to become free. Usage count = 2 Fix the dst leak by removing the dst_hold() in ip6_negative_advice(). The patch that introduced the dst_hold() in ip6_negative_advice() was 92f1655aa2b22 ("net: fix __dst_negative_advice() race"). But 92f1655aa2b22 merely refactored the code with regards to the dst refcount so the issue was present even before 92f1655aa2b22. The bug was introduced in 54c1a859efd9f ("ipv6: Don't drop cache route entry unless timer actually expired.") where the expired cached route is deleted and the sk_dst_cache member of the socket is set to NULL by calling dst_negative_advice() but the refcount belonging to the socket is left unbalanced. The IPv4 version - ipv4_negative_advice() - is not affected by this bug. When the TCP connection times out ipv4_negative_advice() merely resets the sk_dst_cache of the socket while decrementing the refcount of the exception dst.
05 / REFERENCES
Further evidence
- https://git.kernel.org/linus/3301ab7d5aeb0fe270f73a3d4810c9d1b6a9f045
- https://git.kernel.org/stable/c/0b8903e6c881f72c6849d4952de742c656eb5ab9
- https://git.kernel.org/stable/c/3301ab7d5aeb0fe270f73a3d4810c9d1b6a9f045
- https://git.kernel.org/stable/c/535add1e9f274502209cb997801208bbe1ae6c6f
- https://git.kernel.org/stable/c/8b591bd522b71c42a82898290e35d32b482047e4
- https://git.kernel.org/stable/c/a95808252e8acc0123bacd2dff8b9af10bc145b7
- https://git.kernel.org/stable/c/b90d061345bb8cd51fece561a800bae1c95448a6
- https://git.kernel.org/stable/c/f43d12fd0fa8ee5b9caf8a3927e10d06431764d2
- https://ubuntu.com/security/CVE-2024-56644
- https://ubuntu.com/security/notices/USN-7379-1
- https://ubuntu.com/security/notices/USN-7379-2
- https://ubuntu.com/security/notices/USN-7380-1
- https://ubuntu.com/security/notices/USN-7381-1
- https://ubuntu.com/security/notices/USN-7382-1
- https://ubuntu.com/security/notices/USN-7387-1
- https://ubuntu.com/security/notices/USN-7387-2
- https://ubuntu.com/security/notices/USN-7387-3
- https://ubuntu.com/security/notices/USN-7388-1
- https://ubuntu.com/security/notices/USN-7389-1
- https://ubuntu.com/security/notices/USN-7390-1
- https://ubuntu.com/security/notices/USN-7391-1
- https://ubuntu.com/security/notices/USN-7392-1
- https://ubuntu.com/security/notices/USN-7392-2
- https://ubuntu.com/security/notices/USN-7392-3
- https://ubuntu.com/security/notices/USN-7392-4
- https://ubuntu.com/security/notices/USN-7393-1
- https://ubuntu.com/security/notices/USN-7401-1
- https://ubuntu.com/security/notices/USN-7407-1
- https://ubuntu.com/security/notices/USN-7413-1
- https://ubuntu.com/security/notices/USN-7421-1
- https://ubuntu.com/security/notices/USN-7449-1
- https://ubuntu.com/security/notices/USN-7449-2
- https://ubuntu.com/security/notices/USN-7450-1
- https://ubuntu.com/security/notices/USN-7451-1
- https://ubuntu.com/security/notices/USN-7452-1
- https://ubuntu.com/security/notices/USN-7453-1
- https://ubuntu.com/security/notices/USN-7458-1
- https://ubuntu.com/security/notices/USN-7459-1
- https://ubuntu.com/security/notices/USN-7459-2
- https://ubuntu.com/security/notices/USN-7463-1
- https://ubuntu.com/security/notices/USN-7468-1
- https://ubuntu.com/security/notices/USN-7523-1
- https://ubuntu.com/security/notices/USN-7524-1
- https://ubuntu.com/security/notices/USN-7539-1
- https://ubuntu.com/security/notices/USN-7540-1
- https://www.cve.org/CVERecord?id=CVE-2024-56644