CVE-2024-41012

filelock: Remove locks reliably when fcntl/close race is detected

7.8 high EPSS 0.23%

Published 23 Jul 2024 Updated 5 Aug 2026 CNA: Linux

Check your servers for CVE-2024-41012

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-2024-41012 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.

Check my servers

Description

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

filelock: Remove locks reliably when fcntl/close race is detected

When fcntl_setlk() races with close(), it removes the created lock with do_lock_file_wait(). However, LSMs can allow the first do_lock_file_wait() that created the lock while denying the second do_lock_file_wait() that tries to remove the lock. Separately, posix_lock_file() could also fail to remove a lock due to GFP_KERNEL allocation failure (when splitting a range in the middle).

After the bug has been triggered, use-after-free reads will occur in lock_get_status() when userspace reads /proc/locks. This can likely be used to read arbitrary kernel memory, but can't corrupt kernel memory.

Fix it by calling locks_remove_posix() instead, which is designed to reliably get rid of POSIX locks associated with the given file and files_struct and is also used by filp_flush().

Severity (CVSS)

7.8 high CVSS 3.1 from Linux (CNA)
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.23%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 14.7% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 10 Sep 2024):

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.

ProductVersions
Linux
affected from c293621bbf678a3d85e3ed721c3921c8a670610d, before d30ff33040834c3b9eee29740acd92f9c7ba2250
affected from c293621bbf678a3d85e3ed721c3921c8a670610d, before dc2ce1dfceaa0767211a9d963ddb029ab21c4235
affected from c293621bbf678a3d85e3ed721c3921c8a670610d, before 5661b9c7ec189406c2dde00837aaa4672efb6240
affected from c293621bbf678a3d85e3ed721c3921c8a670610d, before 52c87ab18c76c14d7209646ccb3283b3f5d87b22
affected from c293621bbf678a3d85e3ed721c3921c8a670610d, before ef8fc41cd6f95f9a4a3470f085aecf350569a0b3
affected from c293621bbf678a3d85e3ed721c3921c8a670610d, before 5f5d0799eb0a01d550c21b7894e26b2d9db55763
affected from c293621bbf678a3d85e3ed721c3921c8a670610d, before b6d223942c34057fdfd8f149e763fa823731b224
affected from c293621bbf678a3d85e3ed721c3921c8a670610d, before 3cad1bc010416c6dd780643476bc59ed742436b9
Other versions: unaffected
Linux
affected 2.6.13
unaffected before 2.6.13
unaffected from 4.19.319 up to and including 4.19.*
unaffected from 5.4.281 up to and including 5.4.*
unaffected from 5.10.223 up to and including 5.10.*
unaffected from 5.15.164 up to and including 5.15.*
unaffected from 6.1.101 up to and including 6.1.*
unaffected from 6.6.42 up to and including 6.6.*
unaffected from 6.9.9 up to and including 6.9.*
unaffected 6.10 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-2024-41012 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2024-41012

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-2024-41012
trivy image --scanners vuln IMAGE | grep CVE-2024-41012

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

Source: the record CVE-2024-41012 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.