CVE-2022-2959: Linux Kernel Watch Queue Race Condition Privilege Escalation Vulnerability
A race condition was found in the Linux kernel's watch queue due to a missing lock in piperesizering(). The race condition may happen when thread (A) uses ioctl(IOCWATCHQUEUESETSIZE) to resize the pipe buffer and free the old pipe buffer, while another thread (B) uses keyctl() to trigger a notification in the watch queue, calling postonenotification() and accessing the freed pipe buffer.
ZDI advisory: https://www.zerodayinitiative.com/advisories/ZDI-22-1165/
Upstream fix: https://github.com/torvalds/linux/commit/189b0ddc245139af81198d1a3637cac74f96e13a
Other sources
A race condition was found in the Linux kernel's watch queue due to a missing lock in piperesizering(). The specific flaw exists within the handling of pipe buffers. The issue results from the lack of proper locking when performing operations on an object. This flaw allows a local user to crash the system or escalate their privileges on the system.
A race condition was found in the Linux kernel's watch queue due to a missing lock in the piperesizering(). The race condition occurs when a thread uses ioctl(IOCWATCHQUEUESETSIZE) to resize the pipe buffer and free the old pipe buffer, while another thread uses keyctl() to trigger a notification in the watch queue, calling postonenotification() and accessing the freed pipe buffer. This flaw allows a local user to crash the system or escalate their privileges on the system.
This vulnerability allows local attackers to escalate privileges on affected installations of Linux Kernel. An attacker must first obtain the ability to execute low-privileged code on the target system in order to exploit this vulnerability. The specific flaw exists within the handling of pipe buffers. The issue results from the lack of proper locking when performing operations on an object. An attacker can leverage this vulnerability to escalate privileges and execute arbitrary code in the context of the kernel.
— ZDI
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 0:5.14.0-162.12.1.el9_1 - Upgrade
Upgrade
redhat/kernel-rtto a version that resolves this vulnerability.Fixed in 0:5.14.0-162.12.1.rt21.175.el9_1 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 0:5.14.0-70.36.1.el9_0 - Upgrade
Upgrade
redhat/kernel-rtto a version that resolves this vulnerability.Fixed in 0:5.14.0-70.36.1.rt21.108.el9_0 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.25-1Fixed in 6.12.27-1 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 5.19
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is the severity of CVE-2022-2959?
CVE-2022-2959 has a medium severity level due to its potential impact on system stability and security.
How do I fix CVE-2022-2959?
To fix CVE-2022-2959, update to a patched version of the Linux kernel or kernel-rt as specified in the remediation versions from your distribution.
What versions are affected by CVE-2022-2959?
CVE-2022-2959 affects various versions of the Linux kernel prior to the patched releases, including those between 5.8 and 5.17.
What is a race condition in relation to CVE-2022-2959?
A race condition in CVE-2022-2959 occurs due to concurrent access to the watch queue which can lead to a system crash or unreadable data.
Which Linux distributions are affected by CVE-2022-2959?
CVE-2022-2959 affects several Linux distributions including Red Hat, Debian, and others that utilize the vulnerable versions of the Linux kernel.