CVE-2025-22005 in Linuxinfo

Summary

by MITRE • 04/03/2025

In the Linux kernel, the following vulnerability has been resolved:

ipv6: Fix memleak of nhc_pcpu_rth_output in fib_check_nh_v6_gw().

fib_check_nh_v6_gw() expects that fib6_nh_init() cleans up everything when it fails.

Commit 7dd73168e273 ("ipv6: Always allocate pcpu memory in a fib6_nh") moved fib_nh_common_init() before alloc_percpu_gfp() within fib6_nh_init() but forgot to add cleanup for fib6_nh->nh_common.nhc_pcpu_rth_output in case it fails to allocate fib6_nh->rt6i_pcpu, resulting in memleak.

Let's call fib_nh_common_release() and clear nhc_pcpu_rth_output in the error path.

Note that we can remove the fib6_nh_release() call in nh_create_ipv6() later in net-next.git.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 02/16/2026

The vulnerability CVE-2025-22005 represents a memory leak in the Linux kernel's IPv6 networking implementation that occurs within the fib_check_nh_v6_gw() function. This issue specifically affects the handling of per-CPU routing tables during IPv6 neighbor discovery and routing table validation processes. The problem manifests when the kernel attempts to initialize IPv6 next-hop structures but fails to properly clean up allocated memory resources in error conditions, leading to gradual memory consumption that could potentially impact system stability and performance over time.

The technical flaw stems from a code modification in commit 7dd73168e273 which restructured the initialization sequence within fib6_nh_init() by moving fib_nh_common_init() before alloc_percpu_gfp() calls. This reordering inadvertently created a scenario where if the allocation of fib6_nh->rt6i_pcpu fails, the nhc_pcpu_rth_output field within the fib6_nh structure is not properly cleaned up. The function fib_check_nh_v6_gw() relies on fib6_nh_init() to perform complete cleanup when initialization fails, but the current implementation fails to address this specific memory allocation path, resulting in a persistent memory leak.

The operational impact of this vulnerability extends beyond simple memory consumption as it represents a potential denial of service vector for systems heavily reliant on IPv6 networking operations. Network infrastructure devices, routers, and servers processing large volumes of IPv6 traffic could experience progressive memory degradation, leading to system instability, reduced performance, or complete system exhaustion of available memory resources. The leak specifically affects per-CPU memory allocations which means the impact may be more pronounced in multi-core systems where multiple CPU cores could accumulate leaked memory over time. This vulnerability aligns with CWE-401: "Improper Release of Memory" and represents a classic case of resource management failure in kernel space operations.

The fix implemented addresses this memory leak by ensuring proper cleanup of the nhc_pcpu_rth_output field when allocation failures occur during the fib6_nh_init() process. The solution involves calling fib_nh_common_release() and explicitly clearing the nhc_pcpu_rth_output field in error paths, thereby restoring proper resource management. This remediation follows established kernel development practices for memory management and aligns with ATT&CK technique T1490: "Inhibit System Recovery" through memory exhaustion, which could be leveraged by adversaries to perform persistent denial of service attacks. The fix also includes a note that fib6_nh_release() calls in nh_create_ipv6() can be removed in future kernel versions, indicating the cleanup process has been properly centralized. Organizations should prioritize patching this vulnerability as it represents a fundamental memory management issue that could be exploited to degrade system performance or availability, particularly in high-traffic IPv6 network environments. The vulnerability affects all Linux kernel versions that include the problematic commit and requires immediate attention from system administrators managing IPv6-enabled networks.

Responsible

Linux

Reservation

12/29/2024

Disclosure

04/03/2025

Moderation

accepted

CPE

ready

EPSS

0.00163

KEV

no

Activities

very low

Sources

Want to know what is going to be exploited?

We predict KEV entries!