CVE-2025-39965

Published Oct 13, 2025

Last updated 3 months ago

Linux Kernel

Overview

AI description

Automated description summarized from trusted sources.

CVE-2025-39965 is a use-after-free (UAF) vulnerability in the Linux kernel's XFRM subsystem, which is responsible for implementing the IPsec protocol. The vulnerability stems from the `xfrm_alloc_spi` function in the `net/xfrm/xfrm_state.c` file. This function, which is called via the `XFRM_MSG_ALLOCSPI` Netlink message from user space, is responsible for allocating SPIs (Security Parameter Indexes). A recent commit modified the allocation logic to prevent SPI duplication. However, the `get_random_u32_inclusive` function can return 0, which isn't checked by `xfrm_alloc_spi`. As a result, an `xfrm_state` object can be allocated with an SPI value of 0 and added to the `byspi` global list. Since SPI=0 typically signifies that no SPI is assigned, the `__xfrm_state_delete` function doesn't remove such objects from the `byspi` list when cleaning up. This leaves a dangling pointer in the `byspi` list, leading to a use-after-free condition when the memory is accessed again.

Description
In the Linux kernel, the following vulnerability has been resolved: xfrm: xfrm_alloc_spi shouldn't use 0 as SPI x->id.spi == 0 means "no SPI assigned", but since commit 94f39804d891 ("xfrm: Duplicate SPI Handling"), we now create states and add them to the byspi list with this value. __xfrm_state_delete doesn't remove those states from the byspi list, since they shouldn't be there, and this shows up as a UAF the next time we go through the byspi list.
Source
416baaa9-dc9f-4396-8d5f-8c081fb06d67
NVD status
Awaiting Analysis

Social media

Hype score is a measure of social media activity compared against trending CVEs from the past 12 months. Max score 100.

Hype score

10