CVE-2025-39797
Linux Kernel vulnerability analysis and mitigation

Overview

CVE-2025-39797 is a vulnerability discovered in the Linux kernel's XFRM subsystem, specifically related to duplicate Security Parameter Index (SPI) handling. The issue was disclosed on September 12, 2025, affecting the Linux kernel's network security framework. The vulnerability occurs when Strongswan initiates an XFRMMSGALLOCSPI Netlink message, which triggers the kernel function xfrmallocspi() (NVD).

Technical details

The vulnerability stems from the xfrmallocspi() function's inability to properly ensure uniqueness of Security Parameter Index (SPI) for inbound Security Associations (SAs). The function can return success even when the requested SPI is already in use, leading to duplicate SPIs being assigned to multiple inbound SAs that are only differentiated by their destination addresses. The current implementation's xfrmspihash() lookup function computes hash using daddr, proto, and family, which allows SAs with the same SPI but different destination addresses to hash into different buckets and be stored in different linked lists (AttackerKB).

Impact

When exploited, this vulnerability causes inconsistencies during SPI lookups for inbound packets. Since the lookup may return an arbitrary SA among those with the same SPI, packet processing can fail, resulting in packet drops. This behavior contradicts RFC 4301 section 4.4.2, which states that for inbound processing, a unicast SA should be uniquely identified by the SPI and optionally protocol (NVD).

Mitigation and workarounds

A proposed fix involves modifying the xfrmstatelookupspiproto() function to perform a truly global search across all states, regardless of hash bucket, and match SPI and proto. This ensures proper handling of duplicate SPIs and prevents inconsistent packet processing (NVD).

Additional resources


SourceThis report was generated using AI

Related Linux Kernel vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-40344N/AN/A
  • Linux KernelLinux Kernel
  • kernel-debug-modules-internal
NoYesDec 09, 2025
CVE-2025-40343N/AN/A
  • Linux KernelLinux Kernel
  • kernel-64k-debug-devel
NoYesDec 09, 2025
CVE-2025-40342N/AN/A
  • Linux KernelLinux Kernel
  • kernel-64k-debug-devel-matched
NoYesDec 09, 2025
CVE-2025-40341N/AN/A
  • Linux KernelLinux Kernel
  • kernel-rt-64k-debug-modules-extra
NoYesDec 09, 2025
CVE-2025-40340N/AN/A
  • Linux KernelLinux Kernel
  • kernel-rt-64k-debug-kvm
NoYesDec 09, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management