# CVE-2024-40913: cachefiles: defer exposing anon_fd until after copy_to_user() succeeds

- Severity: High 7.8 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.29%, higher than 22% of CVEs (2026-12-01)
- Published: 2024-07-12T12:24:57.363Z
- Modified: 2026-06-17T07:46:51.360Z
- Weaknesses: CWE-416
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

In the Linux kernel, the following vulnerability has been resolved:

cachefiles: defer exposing anon_fd until after copy_to_user() succeeds

After installing the anonymous fd, we can now see it in userland and close
it. However, at this point we may not have gotten the reference count of
the cache, but we will put it during colse fd, so this may cause a cache
UAF.

So grab the cache reference count before fd_install(). In addition, by
kernel convention, fd is taken over by the user land after fd_install(),
and the kernel should not call close_fd() after that, i.e., it should call
fd_install() after everything is ready, thus fd_install() is called after
copy_to_user() succeeds.

(As written by CVE List.)

## Affected

- Linux Linux: from c8383054506c77b814489c09877b5db83fd4abf2 before eac51d9daacd61dcc93333ff6a890cf3efc8c1c0; from c8383054506c77b814489c09877b5db83fd4abf2 before d2d3eb377a5d081bf2bed177d354a4f59b74da88; from c8383054506c77b814489c09877b5db83fd4abf2 before b9f58cdae6a364a3270fd6b6a46e0fd4f7f8ce32; from c8383054506c77b814489c09877b5db83fd4abf2 before 4b4391e77a6bf24cba2ef1590e113d9b73b11039; 5.19 (not affected: before 5.19; from 6.1.95 up to 6.1.*; from 6.6.35 up to 6.6.*; from 6.9.6 up to 6.9.*; from 6.10 up to *)
- linux linux_kernel: from 5.19 before 6.1.95; from 6.2 before 6.6.35; from 6.7 before 6.9.6; 6.10

## References

- <https://git.kernel.org/stable/c/eac51d9daacd61dcc93333ff6a890cf3efc8c1c0> (patch)
- <https://git.kernel.org/stable/c/d2d3eb377a5d081bf2bed177d354a4f59b74da88> (patch)
- <https://git.kernel.org/stable/c/b9f58cdae6a364a3270fd6b6a46e0fd4f7f8ce32> (patch)
- <https://git.kernel.org/stable/c/4b4391e77a6bf24cba2ef1590e113d9b73b11039> (patch)
- <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html>

## Sources

- CVE List: [CVE-2024-40913](https://www.cve.org/CVERecord?id=CVE-2024-40913), CVE Terms of Use, modified 2026-05-11
- NVD: [CVE-2024-40913](https://nvd.nist.gov/vuln/detail/CVE-2024-40913), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2024-40913 · Whole record: https://cve.day/CVE-2024-40913.json · Rebuilt by cve.day 2026-11-25T22:58:42.835Z
