CVE-2025-38165

5.5 MEDIUM

📋 TL;DR

A race condition in the Linux kernel's BPF sockmap subsystem can cause a kernel panic when processing large network packets. This vulnerability affects systems running vulnerable Linux kernel versions with BPF sockmap enabled, potentially leading to denial of service. The issue occurs when skb_linearize() is called on a shared socket buffer (skb) that hasn't been properly reference counted.

💻 Affected Systems

Products:
  • Linux kernel
Versions: Specific vulnerable versions not explicitly stated, but references indicate stable kernel patches from 3d25fa2d7f127348c818e1dab9e58534f7ac56cc to db1d15a26f21f97459508c42ae87cabe8d3afc3b
Operating Systems: Linux distributions using affected kernel versions
Default Config Vulnerable: ✅ No
Notes: Requires BPF sockmap to be enabled and configured, typically not default. The vulnerability is triggered when processing packets larger than MAX_MSG_FRAGS (typically 100KB) through strparser with sockmap.

📦 What is this software?

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Kernel panic leading to system crash and complete denial of service, requiring physical or remote reboot.

🟠

Likely Case

System instability or crash when processing large network packets through BPF sockmap, causing service disruption.

🟢

If Mitigated

Minor performance impact from the fix, but no security or stability issues.

🌐 Internet-Facing: MEDIUM - Requires specific BPF sockmap configuration and large packet processing, but could be triggered remotely.
🏢 Internal Only: LOW - Typically requires local or privileged access to configure BPF programs that trigger the condition.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

The provided benchmark command demonstrates exploitation. Requires ability to configure BPF sockmap programs and send large packets, typically needing root or CAP_BPF privileges.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Kernel versions with commits 3d25fa2d7f127348c818e1dab9e58534f7ac56cc through db1d15a26f21f97459508c42ae87cabe8d3afc3b

Vendor Advisory: https://git.kernel.org/stable/c/3d25fa2d7f127348c818e1dab9e58534f7ac56cc

Restart Required: Yes

Instructions:

1. Identify your kernel version with 'uname -r'. 2. Check if your distribution has released security updates. 3. Update kernel packages via your package manager (apt, yum, dnf, etc.). 4. Reboot the system to load the new kernel.

🔧 Temporary Workarounds

Disable BPF sockmap

linux

Prevent the vulnerable code path by disabling BPF sockmap functionality

sysctl -w net.core.bpf_sockmap=0
echo 0 > /proc/sys/net/core/bpf_sockmap

Limit packet sizes

linux

Configure network interfaces or applications to avoid packets larger than MAX_MSG_FRAGS

iptables -A INPUT -p tcp -m length --length 100000: -j DROP
Configure application MTU settings

🧯 If You Can't Patch

  • Disable BPF sockmap functionality system-wide
  • Implement network filtering to block packets larger than 100KB that could trigger the vulnerability

🔍 How to Verify

Check if Vulnerable:

Check kernel version and if BPF sockmap is enabled: 'uname -r' and 'sysctl net.core.bpf_sockmap'

Check Version:

uname -r

Verify Fix Applied:

Verify kernel version is patched and test with the benchmark command: './bench sockmap -c 2 -p 1 -a --rx-verdict-ingress --rx-strp 100000' should not cause panic

📡 Detection & Monitoring

Log Indicators:

  • Kernel panic messages mentioning 'skb_linearize' or 'pskb_expand_head'
  • Workqueue: events sk_psock_backlog in crash logs
  • BUG at net/core/skbuff.c:2178

Network Indicators:

  • Large packet bursts (100KB+) to systems with BPF sockmap enabled
  • Abnormal TCP connection resets after large data transfers

SIEM Query:

event.category:kernel AND (message:"skb_linearize" OR message:"pskb_expand_head" OR message:"sk_psock_backlog")

🔗 References

📤 Share & Export