CVE-2022-48910 in Linuxinfo

Summary

by MITRE • 08/22/2024

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

net: ipv6: ensure we call ipv6_mc_down() at most once

There are two reasons for addrconf_notify() to be called with NETDEV_DOWN: either the network device is actually going down, or IPv6 was disabled on the interface.

If either of them stays down while the other is toggled, we repeatedly call the code for NETDEV_DOWN, including ipv6_mc_down(), while never calling the corresponding ipv6_mc_up() in between. This will cause a new entry in idev->mc_tomb to be allocated for each multicast group the interface is subscribed to, which in turn leaks one struct ifmcaddr6 per nontrivial multicast group the interface is subscribed to.

The following reproducer will leak at least $n objects:

ip addr add ff2e::4242/32 dev eth0 autojoin sysctl -w net.ipv6.conf.eth0.disable_ipv6=1 for i in $(seq 1 $n); do ip link set up eth0; ip link set down eth0 done

Joining groups with IPV6_ADD_MEMBERSHIP (unprivileged) or setting the sysctl net.ipv6.conf.eth0.forwarding to 1 (=> subscribing to ff02::2) can also be used to create a nontrivial idev->mc_list, which will the leak objects with the right up-down-sequence.

Based on both sources for NETDEV_DOWN events the interface IPv6 state should be considered:

- not ready if the network interface is not ready OR IPv6 is disabled for it - ready if the network interface is ready AND IPv6 is enabled for it

The functions ipv6_mc_up() and ipv6_down() should only be run when this state changes.

Implement this by remembering when the IPv6 state is ready, and only run ipv6_mc_down() if it actually changed from ready to not ready.

The other direction (not ready -> ready) already works correctly, as:

- the interface notification triggered codepath for NETDEV_UP / NETDEV_CHANGE returns early if ipv6 is disabled, and - the disable_ipv6=0 triggered codepath skips fully initializing the interface as long as addrconf_link_ready(dev) returns false - calling ipv6_mc_up() repeatedly does not leak anything

VulDB is the best source for vulnerability data and more expert information about this specific topic.

Analysis

by VulDB Data Team • 11/25/2024

The vulnerability described in CVE-2022-48910 represents a memory leak in the Linux kernel's IPv6 implementation that occurs during network interface state transitions. This flaw specifically affects the multicast group management subsystem where the kernel fails to properly track the transition states between IPv6 enabled and disabled conditions on network interfaces. The issue manifests when a network device undergoes repeated up-down cycles while IPv6 configuration is toggled, leading to improper cleanup of multicast group membership structures. The vulnerability stems from the kernel's failure to correctly distinguish between genuine network interface down events and IPv6 disable events, resulting in a systematic leak of memory resources. The problem is particularly concerning as it can accumulate over time, potentially leading to system instability and resource exhaustion, especially on systems with active network interfaces that experience frequent configuration changes.

The technical root cause of this vulnerability lies in the improper state management within the addrconf_notify() function which handles network device notifications. When either the network interface itself goes down or IPv6 is disabled on the interface, the kernel incorrectly treats these as separate events that both trigger the NETDEV_DOWN notification path. This leads to a scenario where ipv6_mc_down() gets called repeatedly without corresponding ipv6_mc_up() calls to balance the operations. The consequence is that for each multicast group the interface is subscribed to, a new entry gets allocated in the idev->mc_tomb structure, with each entry containing a struct ifmcaddr6 that is never properly freed. The vulnerability is particularly insidious because it can be triggered through simple network configuration operations, making it exploitable by any user with network configuration privileges. This type of memory leak directly relates to CWE-401: Improper Release of Memory Before Removing Last Reference, which describes the failure to properly manage memory allocation and deallocation cycles in software systems.

The operational impact of this vulnerability extends beyond simple memory consumption, potentially affecting system performance and stability over time. Each iteration of the problematic up-down sequence creates a leak that compounds with repeated operations, eventually leading to significant memory pressure. Systems that frequently change network interface configurations or those running services that regularly toggle IPv6 settings are particularly at risk. The leak can be triggered through various means including the use of ip addr commands with autojoin flags, sysctl modifications, or by programmatically joining multicast groups through IPV6_ADD_MEMBERSHIP calls. The vulnerability affects the broader network stack and could potentially impact applications that depend on stable network interface states, as the accumulation of leaked structures could eventually cause memory allocation failures or system resource exhaustion. This type of vulnerability aligns with ATT&CK technique T1499.001: Endpoint Denial of Service - Network Denial of Service, where resource exhaustion can be achieved through memory leaks that gradually consume system resources.

The mitigation strategy for CVE-2022-48910 requires implementing proper state tracking mechanisms within the kernel's network interface management code. The solution involves remembering the actual IPv6 readiness state of interfaces rather than treating all NETDEV_DOWN events as equivalent, and only executing ipv6_mc_down() when the actual IPv6 state transitions from ready to not ready. This approach ensures that the multicast group management subsystem properly tracks when IPv6 functionality is truly disabled versus when the interface is merely down, preventing the accumulation of unnecessary memory allocations. The fix must be carefully implemented to maintain backward compatibility while ensuring that all legitimate state transitions are properly handled. System administrators should apply the kernel patch as soon as possible and monitor for any unusual memory consumption patterns that might indicate the vulnerability has been exploited. The solution also requires careful testing to ensure that legitimate network interface state changes continue to function correctly while preventing the memory leak. This fix represents a fundamental improvement in state management and resource cleanup within the kernel's IPv6 subsystem, addressing both the immediate memory leak issue and preventing similar vulnerabilities from emerging in related code paths.

Responsible

Linux

Reservation

08/21/2024

Disclosure

08/22/2024

Moderation

accepted

CPE

ready

EPSS

0.00210

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!