Vulnerabilities > CVE-2023-52638 - Improper Locking vulnerability in Linux Kernel
Summary
In the Linux kernel, the following vulnerability has been resolved: can: j1939: prevent deadlock by changing j1939_socks_lock to rwlock The following 3 locks would race against each other, causing the deadlock situation in the Syzbot bug report: - j1939_socks_lock - active_session_list_lock - sk_session_queue_lock A reasonable fix is to change j1939_socks_lock to an rwlock, since in the rare situations where a write lock is required for the linked list that j1939_socks_lock is protecting, the code does not attempt to acquire any more locks. This would break the circular lock dependency, where, for example, the current thread already locks j1939_socks_lock and attempts to acquire sk_session_queue_lock, and at the same time, another thread attempts to acquire j1939_socks_lock while holding sk_session_queue_lock. NOTE: This patch along does not fix the unregister_netdevice bug reported by Syzbot; instead, it solves a deadlock situation to prepare for one or more further patches to actually fix the Syzbot bug, which appears to be a reference counting problem within the j1939 codebase. [mkl: remove unrelated newline change]
Vulnerable Configurations
Common Weakness Enumeration (CWE)
Common Attack Pattern Enumeration and Classification (CAPEC)
- Leveraging Race Conditions This attack targets a race condition occurring when multiple processes access and manipulate the same resource concurrently and the outcome of the execution depends on the particular order in which the access takes place. The attacker can leverage a race condition by "running the race", modifying the resource and modifying the normal execution flow. For instance a race condition can occur while accessing a file, the attacker can trick the system by replacing the original file with his version and cause the system to read the malicious file.
- Leveraging Race Conditions via Symbolic Links This attack leverages the use of symbolic links (Symlinks) in order to write to sensitive files. An attacker can create a Symlink link to a target file not otherwise accessible to her. When the privileged program tries to create a temporary file with the same name as the Symlink link, it will actually write to the target file pointed to by the attackers' Symlink link. If the attacker can insert malicious content in the temporary file she will be writing to the sensitive file by using the Symlink. The race occurs because the system checks if the temporary file exists, then creates the file. The attacker would typically create the Symlink during the interval between the check and the creation of the temporary file.
References
- https://git.kernel.org/stable/c/03358aba991668d3bb2c65b3c82aa32c36851170
- https://git.kernel.org/stable/c/03358aba991668d3bb2c65b3c82aa32c36851170
- https://git.kernel.org/stable/c/26dfe112ec2e95fe0099681f6aec33da13c2dd8e
- https://git.kernel.org/stable/c/26dfe112ec2e95fe0099681f6aec33da13c2dd8e
- https://git.kernel.org/stable/c/559b6322f9480bff68cfa98d108991e945a4f284
- https://git.kernel.org/stable/c/559b6322f9480bff68cfa98d108991e945a4f284
- https://git.kernel.org/stable/c/6cdedc18ba7b9dacc36466e27e3267d201948c8d
- https://git.kernel.org/stable/c/6cdedc18ba7b9dacc36466e27e3267d201948c8d
- https://git.kernel.org/stable/c/aedda066d717a0b4335d7e0a00b2e3a61e40afcf
- https://git.kernel.org/stable/c/aedda066d717a0b4335d7e0a00b2e3a61e40afcf