7.5high
net/ipv6: release expired exception dst cached in socket
- Severity
- 7.5high CVSS:3.1 by Linux
- Exploit likelihood
- 1.00% (higher than 62% of CVEs)
- Published
- Last changed
- Assigned by
- Linux
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 54c1a859efd9fd6cda05bc700315ba2519c14eba before a95808252e8acc0123bacd2dff8b9af10bc145b7, from 54c1a859efd9fd6cda05bc700315ba2519c14eba before b90d061345bb8cd51fece561a800bae1c95448a6, from 54c1a859efd9fd6cda05bc700315ba2519c14eba before 0b8903e6c881f72c6849d4952de742c656eb5ab9, from 54c1a859efd9fd6cda05bc700315ba2519c14eba before 535add1e9f274502209cb997801208bbe1ae6c6f, from 54c1a859efd9fd6cda05bc700315ba2519c14eba before f43d12fd0fa8ee5b9caf8a3927e10d06431764d2, from 54c1a859efd9fd6cda05bc700315ba2519c14eba before 8b591bd522b71c42a82898290e35d32b482047e4, from 54c1a859efd9fd6cda05bc700315ba2519c14eba before 3301ab7d5aeb0fe270f73a3d4810c9d1b6a9f045, 9c93e9c757c7d3d96027a06b9b4c4e37ca87ded7 and 2 more Not affected: before 2.6.34, from 5.4.287 up to 5.4.*, from 5.10.231 up to 5.10.*, from 5.15.174 up to 5.15.*, from 6.1.120 up to 6.1.*, from 6.6.66 up to 6.6.* | CVE List |
| linux linux_kernel | from 2.6.33.2 before 2.6.34, from 2.6.34.1 before 5.4.287, from 5.5 before 5.10.231, from 5.11 before 5.15.174, from 5.16 before 6.1.120, from 6.2 before 6.6.66, from 6.7 before 6.12.5, 2.6.34 and 1 more | NVD |
| debian debian_linux | 11.0 | NVD |
All scores
| Linux | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
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.
NVD (es)
En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: net/ipv6: liberación de la excepción dst expirada almacenada en caché en el socket. Los objetos Dst se filtran en ip6_negative_advice() cuando se ejecuta esta función para una ruta IPv6 expirada ubicada en la tabla de excepciones. Hay varias condiciones que deben cumplirse para que se produzca la fuga: * se recibe un paquete ICMPv6 que indica un cambio de la MTU para la ruta, lo que da como resultado la creación de un dst de excepción * una conexión TCP que utiliza el dst de excepción para enrutar paquetes debe comenzar a agotar el tiempo de espera para que TCP comience las retransmisiones * después de que el dst de excepción caduque, el recolector de basura FIB6 no debe ejecutarse antes de que TCP ejecute ip6_negative_advice() para el dst de excepción caducado Cuando TCP ejecuta ip6_negative_advice() para un dst de excepción que ha caducado y si ningún otro socket tiene una referencia al dst de excepción, el recuento de referencias del dst de excepción es 2, que corresponde al incremento realizado por dst_init() y el incremento realizado por el socket TCP para el que se agota el tiempo de espera de la conexión. El recuento de referencias realizado por el socket nunca se libera. El recuento de referencias del dst se reduce en sk_dst_reset() pero esa reducción se contrarresta con un dst_hold() colocado intencionalmente justo antes del sk_dst_reset() en ip6_negative_advice(). Después de que ip6_negative_advice() haya terminado, no hay otro objeto vinculado al dst. El socket perdió su referencia almacenada en sk_dst_cache y el dst ya no está en la tabla de excepciones. El dst de excepción se convierte en un objeto filtrado. Como resultado de esta filtración de dst, se informa un recuento de referencias desequilibrado para el dispositivo de bucle invertido de un espacio de nombres de red que se destruye en núcleos que no contienen e5f80fcf869a ("ipv6: dar un dev IPv6 a blackhole_netdev"): unregister_netdevice: esperando a que lo se libere. Recuento de uso = 2 Corrija la filtración de dst eliminando dst_hold() en ip6_negative_advice(). El parche que introdujo dst_hold() en ip6_negative_advice() fue 92f1655aa2b22 ("net: fix __dst_negative_advice() race"). Pero 92f1655aa2b22 simplemente refactorizó el código con respecto al recuento de referencias dst, por lo que el problema estaba presente incluso antes de 92f1655aa2b22. El error se introdujo en 54c1a859efd9f ("ipv6: Don't drop cache route entry sometimes expired.") donde la ruta en caché expirada se elimina y el miembro sk_dst_cache del socket se establece en NULL al llamar a dst_negative_advice(), pero el recuento de referencias que pertenece al socket se deja desequilibrado. La versión IPv4 - ipv4_negative_advice() - no se ve afectada por este error. Cuando se agota el tiempo de conexión TCP, ipv4_negative_advice() simplemente restablece el sk_dst_cache del socket mientras disminuye el recuento de referencias del dst de excepción.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-56644 changed 2026-10-15 | CVE Terms of Use |
| NVD | CVE-2024-56644 changed 2026-10-15 | Public domain |