CVE-2022-50007 in Linuxinfo

Summary

by MITRE • 06/18/2025

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

xfrm: fix refcount leak in __xfrm_policy_check()

The issue happens on an error path in __xfrm_policy_check(). When the fetching process of the object `pols[1]` fails, the function simply
returns 0, forgetting to decrement the reference count of `pols[0]`,
which is incremented earlier by either xfrm_sk_policy_lookup() or xfrm_policy_lookup(). This may result in memory leaks.

Fix it by decreasing the reference count of `pols[0]` in that path.

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Analysis

by VulDB Data Team • 11/30/2025

The vulnerability identified as CVE-2022-50007 represents a critical reference count management flaw within the Linux kernel's IPsec implementation, specifically affecting the xfrm subsystem responsible for packet security policies. This issue manifests in the __xfrm_policy_check() function where improper reference count handling creates a memory leak condition that can persist over time and potentially lead to system instability. The vulnerability arises from the kernel's packet processing logic when handling security policy lookups for IPsec traffic, particularly when the second policy object in the array fails to be fetched successfully. The flaw demonstrates a classic memory management error that violates fundamental kernel programming practices and can have significant operational implications for systems relying on IPsec security services.

The technical root cause of this vulnerability lies in the error handling path of the __xfrm_policy_check() function where the code fails to properly decrement the reference count of the first policy object pols[0] when the second policy object pols[1] cannot be successfully retrieved. During normal operation, the function increments the reference count of pols[0] through either xfrm_sk_policy_lookup() or xfrm_policy_lookup() calls, but when the subsequent fetch operation for pols[1] fails, the code path returns immediately without properly releasing the reference to pols[0]. This creates a reference count leak where the kernel maintains a reference to a policy object that should have been released, leading to memory that cannot be reclaimed by the system's memory management subsystem. The issue is classified as a reference counting error that directly impacts the kernel's memory management integrity and can contribute to gradual memory exhaustion over time.

The operational impact of CVE-2022-50007 extends beyond simple memory consumption as it affects the overall stability and performance of Linux systems implementing IPsec security policies. When this vulnerability is exploited through sustained network traffic or repeated policy lookups, the cumulative effect of reference count leaks can lead to progressive memory degradation, potentially causing system slowdowns, resource exhaustion, or even system crashes under heavy load conditions. The vulnerability is particularly concerning in network infrastructure devices, firewalls, and routers that heavily utilize IPsec for secure communications, as these systems may experience memory pressure that affects their ability to maintain secure connections and process network traffic effectively. The leak can also compound with other memory management issues, creating cascading effects that amplify the overall system instability.

This vulnerability aligns with CWE-466, which describes the use of an incorrect function parameter or improper handling of reference counts in kernel code, and represents a specific instance of improper resource management within the Linux kernel's security subsystem. The issue demonstrates the importance of careful error handling in kernel space where resource management must be deterministic and complete, regardless of execution paths. From an ATT&CK perspective, this vulnerability could be leveraged in resource exhaustion attacks or potentially as a stepping stone for more sophisticated attacks targeting kernel memory management. The fix implemented in the kernel addresses this by ensuring proper reference count decrement in the error path, following standard kernel programming practices that require all acquired references to be properly released. System administrators should prioritize applying the kernel patches that address this vulnerability, particularly in environments where IPsec services are actively utilized and where memory management stability is critical for system operations.

Responsible

Linux

Reservation

06/18/2025

Disclosure

06/18/2025

Moderation

accepted

EPSS

0.00253

KEV

no

Activities

very low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!