CVE-2025-40271
fs/proc: fix uaf in proc_readdir_de()
Check your servers for CVE-2025-40271
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-40271 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
fs/proc: fix uaf in proc_readdir_de()
Pde is erased from subdir rbtree through rb_erase(), but not set the node to EMPTY, which may result in uaf access. We should use RB_CLEAR_NODE() set the erased node to EMPTY, then pde_subdir_next() will return NULL to avoid uaf access.
We found an uaf issue while using stress-ng testing, need to run testcase getdent and tun in the same time. The steps of the issue is as follows:
1) use getdent to traverse dir /proc/pid/net/dev_snmp6/, and current pde is tun3;
2) in the [time windows] unregister netdevice tun3 and tun2, and erase them from rbtree. erase tun3 first, and then erase tun2. the pde(tun2) will be released to slab;
3) continue to getdent process, then pde_subdir_next() will return pde(tun2) which is released, it will case uaf access.
CPU 0 | CPU 1 ------------------------------------------------------------------------- traverse dir /proc/pid/net/dev_snmp6/ | unregister_netdevice(tun->dev) //tun3 tun2 sys_getdents64() | iterate_dir() | proc_readdir() | proc_readdir_de() | snmp6_unregister_dev() pde_get(de); | proc_remove() read_unlock(&proc_subdir_lock); | remove_proc_subtree() | write_lock(&proc_subdir_lock); [time window] | rb_erase(&root->subdir_node, &parent->subdir); | write_unlock(&proc_subdir_lock); read_lock(&proc_subdir_lock); | next = pde_subdir_next(de); | pde_put(de); | de = next; //UAF |
rbtree of dev_snmp6 | pde(tun3) / \ NULL pde(tun2)
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.49%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 43.6% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 16 Jun 2026):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 710585d4922fd315f2cada8fbe550ae8ed23e994, before 1d1596d68a6f11d28f677eedf6cf5b17dbfeb491 affected from 710585d4922fd315f2cada8fbe550ae8ed23e994, before c81d0385500446efe48c305bbb83d47f2ae23a50 affected from 710585d4922fd315f2cada8fbe550ae8ed23e994, before 4cba73c4c89219beef7685a47374bf88b1022369 affected from 710585d4922fd315f2cada8fbe550ae8ed23e994, before 6f2482745e510ae1dacc9b090194b9c5f918d774 affected from 710585d4922fd315f2cada8fbe550ae8ed23e994, before 67272c11f379d9aa5e0f6b16286b9d89b3f76046 affected from 710585d4922fd315f2cada8fbe550ae8ed23e994, before 623bb26127fb581a741e880e1e1a47d79aecb6f8 affected from 710585d4922fd315f2cada8fbe550ae8ed23e994, before 03de7ff197a3d0e17d0d5c58fdac99a63cba8110 affected from 710585d4922fd315f2cada8fbe550ae8ed23e994, before 895b4c0c79b092d732544011c3cecaf7322c36a1
Other versions: unaffected
|
| Linux |
affected 3.19 unaffected before 3.19 unaffected from 5.4.302 up to and including 5.4.* unaffected from 5.10.247 up to and including 5.10.* unaffected from 5.15.197 up to and including 5.15.* unaffected from 6.1.159 up to and including 6.1.* unaffected from 6.6.117 up to and including 6.6.* unaffected from 6.12.59 up to and including 6.12.* unaffected from 6.17.9 up to and including 6.17.* unaffected 6.18 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-40271 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-40271
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-40271
trivy image --scanners vuln IMAGE | grep CVE-2025-40271
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/1d1596d68a6f11d28f677eedf6cf5b17dbfeb491 git.kernel.org
- https://git.kernel.org/stable/c/c81d0385500446efe48c305bbb83d47f2ae23a50 git.kernel.org
- https://git.kernel.org/stable/c/4cba73c4c89219beef7685a47374bf88b1022369 git.kernel.org
- https://git.kernel.org/stable/c/6f2482745e510ae1dacc9b090194b9c5f918d774 git.kernel.org
- https://git.kernel.org/stable/c/67272c11f379d9aa5e0f6b16286b9d89b3f76046 git.kernel.org
- https://git.kernel.org/stable/c/623bb26127fb581a741e880e1e1a47d79aecb6f8 git.kernel.org
- https://git.kernel.org/stable/c/03de7ff197a3d0e17d0d5c58fdac99a63cba8110 git.kernel.org
- https://git.kernel.org/stable/c/895b4c0c79b092d732544011c3cecaf7322c36a1 git.kernel.org
- https://cert-portal.siemens.com/productcert/html/ssa-253495.html cert-portal.siemens.com
Source: the record CVE-2025-40271 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse