Cloudanix VulnDB

CVE-2025-21683

Medium · 5.5

CVSS

5.5

EPSS

0.2%

Published

Jan 31, 2025

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

A bug in the Linux kernel can slowly leak memory when certain networking programs are used, eventually making the system slower or unstable until the kernel is updated.

Exploitation
Local Privilege
Attacker needs
Local User
Complexity
Low
Impact
Denial Of Service
Component
OS kernel
Class
Memory Corruption
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Memory leak in Linux kernel BPF reuseport handling: bpf_sk_select_reuseport() can return an ESTABLISHED TCP socket that had SO_ATTACH_REUSEPORT_EBPF set, causing sk_reuseport_cb to exist without the expected refcount semantics; references are not dropped on both error paths after reuseport_alloc and related calls.

Why it matters to the business

Systems running custom BPF programs on socket reuseport may experience gradual kernel memory exhaustion, leading to degraded performance, increased latency, or eventual service disruption if the leak is triggered repeatedly.

How an attack unfolds

A local user crafts socket operations that attach a BPF program via SO_ATTACH_REUSEPORT_EBPF to a TCP socket, transitions it to ESTABLISHED state, then triggers error paths in sk_setsockopt or reuseport_attach_prog; each iteration leaks an unreferenced 2 KB object allocated via __kmalloc without ever being freed.

How to fix it

Upgrade the Linux kernel to a version containing commit bb36838dac7bb334a3f3d7eb29875593ec9473fc (or later stable equivalent) which adds the missing sk reference drops in both error paths of bpf_sk_select_reuseport().

How to confirm the fix worked

Confirm the running kernel contains commit bb36838dac7bb334a3f3d7eb29875593ec9473fc; re-run the reproducer from the commit message and verify no new unreferenced objects appear in kmemleak or slabinfo for __reuseport_alloc allocations.

Typical attack path

  1. Create a TCP socket and attach a BPF program using SO_ATTACH_REUSEPORT_EBPF
  2. Transition the socket to ESTABLISHED state while the reuseport callback remains attached
  3. Invoke setsockopt paths that call sk_reuseport_attach_bpf and hit an error after reuseport_alloc
  4. Repeat to accumulate unreferenced kernel objects and exhaust memory

How to detect it

Inspect kernel logs and kmemleak reports for unreferenced objects sized 2048 bytes allocated from __reuseport_alloc with backtraces containing reuseport_attach_prog, sk_reuseport_attach_bpf, and sk_setsockopt; correlate with processes calling setsockopt on reuseport sockets.

  • unreferenced object 0xffff8881
  • __reuseport_alloc+0x1d/0x40
  • reuseport_attach_prog+0x87/0x140
  • sk_reuseport_attach_bpf+0xc8/0x100

What your security team should do

  • Apply the fixed kernel version immediately on any system exposing BPF socket programs to untrusted local users
  • Monitor kernel memory usage and enable kmemleak on test systems to detect similar leaks
  • Restrict unprivileged BPF and setsockopt capabilities via seccomp or LSM policies until patched

The record

In the Linux kernel, the following vulnerability has been resolved: bpf: Fix bpf_sk_select_reuseport() memory leak As pointed out in the original comment, lookup in sockmap can return a TCP ESTABLISHED socket. Such TCP socket may have had SO_ATTACH_REUSEPORT_EBPF set before it was ESTABLISHED. In other words, a non-NULL sk_reuseport_cb does not imply a non-refcounted socket. Drop sk's reference in both error paths. unreferenced object 0xffff888101911800 (size 2048): comm "test_progs", pid 44109, jiffies 4297131437 hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 80 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace (crc 9336483b): __kmalloc_noprof+0x3bf/0x560 __reuseport_alloc+0x1d/0x40 reuseport_alloc+0xca/0x150 reuseport_attach_prog+0x87/0x140 sk_reuseport_attach_bpf+0xc8/0x100 sk_setsockopt+0x1181/0x1990 do_sock_setsockopt+0x12b/0x160 __sys_setsockopt+0x7b/0xc0 __x64_sys_setsockopt+0x1b/0x30 do_syscall_64+0x93/0x180 entry_SYSCALL_64_after_hwframe+0x76/0x7e

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 linux 0 No fix
Debian:11 linux 0 5.10.234-1
Debian:11 linux-6.1 0 6.1.128-1~deb11u1
Debian:11 linux-6.1 0 6.1.6.1.128-1~deb11u1
Debian:12 linux 0 6.1.128-1
Debian:13 linux 0 6.12.11-1
Linux Kernel 5.8.0 5.10.234
SUSE:Linux Enterprise High Availability Extension 15 SP6 kernel-default 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise High Availability Extension 15 SP7 kernel-default 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Live Patching 15 SP6 kernel-default 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Live Patching 15 SP6 kernel-livepatch-SLE15-SP6-RT_Update_11 0 1-150600.1.3.2
SUSE:Linux Enterprise Live Patching 15 SP6 kernel-livepatch-SLE15-SP6_Update_11 0 1-150600.13.3.1
SUSE:Linux Enterprise Live Patching 15 SP7 kernel-default 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Live Patching 15 SP7 kernel-livepatch-SLE15-SP7_Update_1 0 1-150700.15.3.1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 kernel-64kb 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 kernel-default 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 kernel-default-base 0 6.4.0-150600.23.50.1.150600.12.22.1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 kernel-source 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 kernel-zfcpdump 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Basesystem 15 SP7 kernel-64kb 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Basesystem 15 SP7 kernel-default 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Basesystem 15 SP7 kernel-default-base 0 6.4.0-150700.53.3.1.150700.17.2.1
SUSE:Linux Enterprise Module for Basesystem 15 SP7 kernel-source 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Basesystem 15 SP7 kernel-zfcpdump 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Confidential Computing Technical Preview 15 SP6 kernel-coco 0 6.4.0-15061.21.coco15sp6.1
SUSE:Linux Enterprise Module for Confidential Computing Technical Preview 15 SP6 kernel-coco_debug 0 6.4.0-15061.21.coco15sp6.1
SUSE:Linux Enterprise Module for Confidential Computing Technical Preview 15 SP6 kernel-source-coco 0 6.4.0-15061.21.coco15sp6.1
SUSE:Linux Enterprise Module for Confidential Computing Technical Preview 15 SP6 kernel-syms-coco 0 6.4.0-15061.21.coco15sp6.1
SUSE:Linux Enterprise Module for Development Tools 15 SP6 kernel-docs 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Development Tools 15 SP6 kernel-obs-build 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Development Tools 15 SP6 kernel-source 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Development Tools 15 SP6 kernel-syms 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Development Tools 15 SP7 kernel-docs 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Development Tools 15 SP7 kernel-obs-build 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Development Tools 15 SP7 kernel-source 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Development Tools 15 SP7 kernel-syms 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Legacy 15 SP6 kernel-default 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Module for Legacy 15 SP7 kernel-default 0 6.4.0-150700.53.3.1
SUSE:Linux Enterprise Module for Public Cloud 15 SP6 kernel-azure 0 6.4.0-150600.8.37.1
SUSE:Linux Enterprise Module for Public Cloud 15 SP6 kernel-source-azure 0 6.4.0-150600.8.37.1
SUSE:Linux Enterprise Module for Public Cloud 15 SP6 kernel-syms-azure 0 6.4.0-150600.8.37.1
SUSE:Linux Enterprise Module for Public Cloud 15 SP7 kernel-azure 0 6.4.0-150700.20.3.1
SUSE:Linux Enterprise Module for Public Cloud 15 SP7 kernel-source-azure 0 6.4.0-150700.20.3.1
SUSE:Linux Enterprise Module for Public Cloud 15 SP7 kernel-syms-azure 0 6.4.0-150700.20.3.1
SUSE:Linux Enterprise Workstation Extension 15 SP6 kernel-default 0 6.4.0-150600.23.50.1
SUSE:Linux Enterprise Workstation Extension 15 SP7 kernel-default 0 6.4.0-150700.53.3.1
SUSE:Real Time Module 15 SP6 kernel-rt 0 6.4.0-150600.10.39.1
SUSE:Real Time Module 15 SP6 kernel-rt_debug 0 6.4.0-150600.10.39.1
SUSE:Real Time Module 15 SP6 kernel-source-rt 0 6.4.0-150600.10.39.1
SUSE:Real Time Module 15 SP6 kernel-syms-rt 0 6.4.0-150600.10.39.1
openSUSE:Leap 15.6 dtb-aarch64 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-64kb 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-azure 0 6.4.0-150600.8.37.1
openSUSE:Leap 15.6 kernel-debug 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-default 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-default-base 0 6.4.0-150600.23.50.1.150600.12.22.1
openSUSE:Leap 15.6 kernel-docs 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-kvmsmall 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-obs-build 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-obs-qa 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-rt 0 6.4.0-150600.10.39.1
openSUSE:Leap 15.6 kernel-rt_debug 0 6.4.0-150600.10.39.1
openSUSE:Leap 15.6 kernel-source 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-source-azure 0 6.4.0-150600.8.37.1
openSUSE:Leap 15.6 kernel-source-rt 0 6.4.0-150600.10.39.1
openSUSE:Leap 15.6 kernel-syms 0 6.4.0-150600.23.50.1
openSUSE:Leap 15.6 kernel-syms-azure 0 6.4.0-150600.8.37.1
openSUSE:Leap 15.6 kernel-syms-rt 0 6.4.0-150600.10.39.1
openSUSE:Leap 15.6 kernel-zfcpdump 0 6.4.0-150600.23.50.1

Related vulnerabilities