В ядре Linux устранена следующая уязвимость:
fhandle: исправлен UAF из-за разблокированного ->mnt_ns, прочитанного в may_decode_fh()
may_decode_fh() обращается к mount::mnt_ns без каких-либо блокировок; что
означает, что монтирование может быть одновременно размонтировано, а пространство mnt_namespace может
одновременно быть освобождены после льготного периода RCU. Эта гонка может происходить следующим образом, если предположить, что точка монтирования была
создано open_tree(..., OPEN_TREE_CLONE):
поток 1 поток 2 RCU
__do_sys_open_by_handle_at
do_handle_open
handle_to_path
may_decode_fh
is_mounted
[mount::mnt_ns доступ]
[mount::mnt_ns доступ]
__do_sys_close
fput_close_sync
__fпут
растворить_on_fput
umount_tree
class_namespace_excl_destructor
namespace_unlock
free_mnt_ns
mnt_ns_tree_remove
call_rcu(mnt_ns_release_rcu)
mnt_ns_release_rcu
mnt_ns_release
свободный
[mnt_namespace::user_ns доступ] **UAF**
Исправьте это, используя rcu_read_lock() для доступа к mount::mnt_ns, например
в __prepend_path(). Кроме того, задокументируйте семантику mount::mnt_ns и используйте WRITE_ONCE().
для писателей, которые могут соревноваться с читателями без замков.
Эта ошибка недоступна, если не установлено одно из следующих условий:
- CONFIG_PREEMPTION
- CONFIG_RCU_STRICT_GRACE_PERIOD
поскольку для этого требуется период отсрочки RCU во время системного вызова без
явное упреждение. Кажется, это не имеет особого влияния на безопасность; в худшем случае это может
утечка результата целочисленного сравнения в пользовательское пространство (с уровня
проверьте cap_capable()), вызовите бесконечный цикл или аварийно завершайте работу ядра,
разыменование недействительного адреса.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: fhandle: fix UAF due to unlocked ->mnt_ns read in may_decode_fh() may_decode_fh() accesses mount::mnt_ns without holding any locks; that means the mount can concurrently be unmounted, and the mnt_namespace can concurrently be freed after an RCU grace period. This race can happens as follows, assuming that the mount point was created by open_tree(..., OPEN_TREE_CLONE): thread 1 thread 2 RCU __do_sys_open_by_handle_at do_handle_open handle_to_path may_decode_fh is_mounted [mount::mnt_ns access] [mount::mnt_ns access] __do_sys_close fput_close_sync __fput dissolve_on_fput umount_tree class_namespace_excl_destructor namespace_unlock free_mnt_ns mnt_ns_tree_remove call_rcu(mnt_ns_release_rcu) mnt_ns_release_rcu mnt_ns_release kfree [mnt_namespace::user_ns access] **UAF** Fix it by taking rcu_read_lock() around the mount::mnt_ns access, like in __prepend_path(). Additionally, document the semantics of mount::mnt_ns, and use WRITE_ONCE() for writers that can race with lockless readers. This bug is unreachable unless one of the following is set: - CONFIG_PREEMPTION - CONFIG_RCU_STRICT_GRACE_PERIOD because it requires an RCU grace period to happen during a syscall without an explicit preemption. This doesn't seem to have interesting security impact; worst-case, it could leak the result of an integer comparison to userspace (from the level check in cap_capable()), cause an endless loop, or crash the kernel by dereferencing an invalid address.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 9
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.11
|
6.12.95
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.36
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.0.13
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc6:*:*:*:*:*:*
|
— | — |