CVE-2025-40271
Linux Kernel vulnerability analysis and mitigation

Overview

CVE-2025-40271 is a use-after-free (UAF) vulnerability in the Linux kernel's proc_readdir_de() function within the fs/proc subsystem. The flaw arises because proc directory entries (pde) are erased from the subdir rbtree via rb_erase() without subsequently calling RB_CLEAR_NODE() to mark the node as empty, allowing pde_subdir_next() to return a pointer to already-freed memory. It was published on December 6–7, 2025, and affects multiple stable Linux kernel versions across various distributions. The CVSS category estimate is Medium (Red Hat CVE, Feedly).

Technical details

The root cause is a use-after-free condition (CWE-416) in proc_readdir_de() within the Linux kernel's /proc filesystem implementation. When a network device (e.g., a TUN interface) is unregistered, its associated proc entry is removed from the rbtree via rb_erase(), but the node is not cleared with RB_CLEAR_NODE(). This leaves the node's pointers in a non-empty state, so a concurrent getdents64() call traversing /proc/<pid>/net/dev_snmp6/ via pde_subdir_next() can follow a stale pointer to a freed slab object. The race condition requires two concurrent operations: a process iterating the proc directory and another thread unregistering network devices, making it a local, timing-dependent exploit (Red Hat CVE). A proof-of-concept exploit has been published on Exploit-DB (Exploit-DB).

Impact

Successful exploitation of this vulnerability can lead to kernel memory corruption via use-after-free access, potentially enabling local privilege escalation or causing a kernel panic (denial of service). An attacker with local access who can create and destroy network interfaces (e.g., TUN devices) while simultaneously performing directory enumeration on /proc/<pid>/net/dev_snmp6/ could trigger the UAF condition. In the worst case, this could allow an unprivileged local user to escalate privileges to root or crash the system (Red Hat CVE, Feedly).

Exploitability

A proof-of-concept exploit for CVE-2025-40271 has been publicly released on Exploit-DB (exploit ID 52550), and the vulnerability was listed among top trending CVEs in May 2026 (Exploit-DB, Reddit CVEWatch). The vulnerability requires local access to the system and the ability to create TUN/network interfaces, limiting its attack surface compared to remote vulnerabilities. The EPSS score is approximately 0.024% (0.000240), indicating a low but non-zero probability of exploitation in the wild. There is no current evidence of active in-the-wild exploitation or CISA KEV catalog listing as of the time of this report.

Exploitation steps

  1. Gain local access: Obtain a local user account on a vulnerable Linux system with permissions to create TUN network interfaces (typically requires CAP_NET_ADMIN or access to /dev/net/tun).
  2. Create TUN interfaces: Use tools such as ip tuntap add or a custom program to create multiple TUN interfaces (e.g., tun2, tun3), which will register proc entries under /proc/<pid>/net/dev_snmp6/.
  3. Initiate concurrent directory traversal: In one thread/process, begin iterating the directory /proc/<pid>/net/dev_snmp6/ using getdents64() (e.g., via the stress-ng getdent test case), pausing mid-traversal on a target entry (e.g., tun3).
  4. Race: unregister network devices: Simultaneously, in another thread, unregister the TUN interfaces (e.g., tun3 then tun2). This triggers snmp6_unregister_dev()proc_remove()rb_erase() without RB_CLEAR_NODE(), freeing the slab memory for tun2's pde.
  5. Trigger UAF: The getdents64() traversal resumes and calls pde_subdir_next(), which follows the stale rbtree pointer to the freed tun2 pde object, resulting in a use-after-free kernel memory access.
  6. Achieve privilege escalation or crash: Depending on heap layout and timing, the attacker may be able to control the freed memory region to redirect kernel execution flow and escalate privileges, or at minimum cause a kernel panic (Exploit-DB, Red Hat CVE).

Indicators of compromise

  • Logs: Kernel oops or BUG messages in /var/log/kern.log or dmesg referencing proc_readdir_de, pde_subdir_next, or use-after-free in the fs/proc subsystem; KASAN (Kernel Address Sanitizer) reports indicating UAF access in proc directory traversal code.
  • Process Behavior: Unusual concurrent activity of processes performing getdents64() on /proc/<pid>/net/dev_snmp6/ alongside rapid creation and deletion of TUN network interfaces; unexpected kernel panics or system reboots on systems with active TUN/TAP usage.
  • Network: Rapid creation and teardown of TUN/TAP interfaces (ip link showing transient tun* interfaces) correlated with directory enumeration activity on /proc network subdirectories.

Mitigation and workarounds

The fix has been applied to multiple stable Linux kernel branches by adding RB_CLEAR_NODE() after rb_erase() in the proc subdir removal path. Vendor-specific patched packages are available from Red Hat (RHSA-2026:1661, RHSA-2026:1662, RHSA-2026:1690, RHSA-2026:2212, RHSA-2026:2759, RHSA-2026:2761, RHSA-2026:2766, RHSA-2026:3268, RHSA-2026:3277, RHSA-2026:3293, RHSA-2026:3358, RHSA-2026:3360, RHSA-2026:3375, RHSA-2026:3388, RHSA-2026:3634, RHSA-2026:3685), Ubuntu (USN-8096-1, USN-8096-2, USN-8096-3, USN-8096-5), Debian LTS (DLA-4436-1), Oracle Linux, AlmaLinux, Rocky Linux, and Amazon Linux 2 (Red Hat Errata, Ubuntu Advisory, Debian LTS). Administrators should update to the latest patched kernel version for their distribution as soon as possible. As a temporary workaround, restricting access to TUN/TAP interface creation (e.g., limiting CAP_NET_ADMIN) can reduce the attack surface.

Community reactions

CVE-2025-40271 appeared in community CVE trending lists in May 2026 following the publication of a proof-of-concept exploit on Exploit-DB, indicating increased researcher attention (Reddit CVEWatch). Red Hat classified the vulnerability status as "Deferred" in their tracking, suggesting it was not considered immediately critical for their product lines (Red Hat CVE). No significant public statements from prominent security researchers or major media coverage beyond standard vulnerability tracking were identified.

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-2026-68454HIGH8.8
  • Linux Kernel logoLinux Kernel
  • linux-xilinx-zynqmp
NoYesAug 13, 2026
CVE-2026-68452HIGH7.8
  • Linux Kernel logoLinux Kernel
  • kernel-zfcpdump-modules-core
NoYesAug 13, 2026
CVE-2026-68451HIGH7.8
  • Linux Kernel logoLinux Kernel
  • linux-aws
NoYesAug 13, 2026
CVE-2026-68453HIGH7.1
  • Linux Kernel logoLinux Kernel
  • kernel-64k-debug-modules-partner
NoYesAug 13, 2026
CVE-2026-68450NONEN/A
  • Linux Kernel logoLinux Kernel
  • linux-aws-fips
NoYesAug 12, 2026

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