В ядре Linux устранена следующая уязвимость:
VMCI: исправлено использование после освобождения при удалении ресурса в vmci_resource_remove(). При удалении ресурса из vmci_resource_table в
vmci_resource_remove(), поиск осуществляется по ресурсу
обрабатывать путем сравнения полей контекста и ресурса. Однако возможно создать два ресурса разных типов.
но тот же дескриптор (те же поля контекста и ресурса).
При попытке удалить один из ресурсов, vmci_resource_remove()
может и не удалить намеченное, но объект все равно освободится
как и в случае с типом датаграммы в vmci_datagram_destroy_handle().
vmci_resource_table по-прежнему будет содержать указатель на этот освобожденный ресурс.
что приводит к уязвимости использования после освобождения. ОШИБКА: KASAN: использование после освобождения в vmci_handle_is_equal include/linux/vmw_vmci_defs.h:142 [inline]
ОШИБКА: KASAN: использование после освобождения в vmci_resource_remove+0x3a1/0x410 driver/misc/vmw_vmci/vmci_resource.c:147
Чтение размера 4 по адресу ffff88801c16d800 с помощью задачи syz-executor197/1592. Отслеживание вызова:
<ЗАДАЧА>
__dump_stack lib/dump_stack.c:88 [встроенный]
dump_stack_lvl+0x82/0xa9 lib/dump_stack.c:106
print_address_description.constprop.0+0x21/0x366 мм/kasan/report.c:239
__kasan_report.cold+0x7f/0x132 мм/kasan/report.c:425
kasan_report+0x38/0x51 мм/kasan/report.c:442
vmci_handle_is_equal include/linux/vmw_vmci_defs.h:142 [встроенный]
vmci_resource_remove+0x3a1/0x410 driver/misc/vmw_vmci/vmci_resource.c:147
vmci_qp_broker_detach+0x89a/0x11b9 driver/misc/vmw_vmci/vmci_queue_pair.c:2182
ctx_free_ctx+0x473/0xbe1 driver/misc/vmw_vmci/vmci_context.c:444
kref_put include/linux/kref.h:65 [встроенный]
vmci_ctx_put driver/misc/vmw_vmci/vmci_context.c:497 [встроенный]
vmci_ctx_destroy+0x170/0x1d6 driver/misc/vmw_vmci/vmci_context.c:195
vmci_host_close+0x125/0x1ac driver/misc/vmw_vmci/vmci_host.c:143
__fput+0x261/0xa34 фс/file_table.c:282
Task_work_run+0xf0/0x194 ядро/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [встроенный]
exit_to_user_mode_loop+0x184/0x189 kernel/entry/common.c:187
exit_to_user_mode_prepare+0x11b/0x123 kernel/entry/common.c:220
__syscall_exit_to_user_mode_work kernel/entry/common.c:302 [встроенный]
syscall_exit_to_user_mode+0x18/0x42 kernel/entry/common.c:313
do_syscall_64+0x41/0x85 Arch/x86/entry/common.c:86
запись_SYSCALL_64_after_hwframe+0x6e/0x0
Это изменение гарантирует, что тип также проверяется при удалении.
ресурс из vmci_resource_table в vmci_resource_remove().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: VMCI: Fix use-after-free when removing resource in vmci_resource_remove() When removing a resource from vmci_resource_table in vmci_resource_remove(), the search is performed using the resource handle by comparing context and resource fields. It is possible though to create two resources with different types but same handle (same context and resource fields). When trying to remove one of the resources, vmci_resource_remove() may not remove the intended one, but the object will still be freed as in the case of the datagram type in vmci_datagram_destroy_handle(). vmci_resource_table will still hold a pointer to this freed resource leading to a use-after-free vulnerability. BUG: KASAN: use-after-free in vmci_handle_is_equal include/linux/vmw_vmci_defs.h:142 [inline] BUG: KASAN: use-after-free in vmci_resource_remove+0x3a1/0x410 drivers/misc/vmw_vmci/vmci_resource.c:147 Read of size 4 at addr ffff88801c16d800 by task syz-executor197/1592 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x82/0xa9 lib/dump_stack.c:106 print_address_description.constprop.0+0x21/0x366 mm/kasan/report.c:239 __kasan_report.cold+0x7f/0x132 mm/kasan/report.c:425 kasan_report+0x38/0x51 mm/kasan/report.c:442 vmci_handle_is_equal include/linux/vmw_vmci_defs.h:142 [inline] vmci_resource_remove+0x3a1/0x410 drivers/misc/vmw_vmci/vmci_resource.c:147 vmci_qp_broker_detach+0x89a/0x11b9 drivers/misc/vmw_vmci/vmci_queue_pair.c:2182 ctx_free_ctx+0x473/0xbe1 drivers/misc/vmw_vmci/vmci_context.c:444 kref_put include/linux/kref.h:65 [inline] vmci_ctx_put drivers/misc/vmw_vmci/vmci_context.c:497 [inline] vmci_ctx_destroy+0x170/0x1d6 drivers/misc/vmw_vmci/vmci_context.c:195 vmci_host_close+0x125/0x1ac drivers/misc/vmw_vmci/vmci_host.c:143 __fput+0x261/0xa34 fs/file_table.c:282 task_work_run+0xf0/0x194 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x184/0x189 kernel/entry/common.c:187 exit_to_user_mode_prepare+0x11b/0x123 kernel/entry/common.c:220 __syscall_exit_to_user_mode_work kernel/entry/common.c:302 [inline] syscall_exit_to_user_mode+0x18/0x42 kernel/entry/common.c:313 do_syscall_64+0x41/0x85 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x6e/0x0 This change ensures the type is also checked when removing the resource from vmci_resource_table in vmci_resource_remove().
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 13
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
3.9
|
4.19.322
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.20
|
5.4.284
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.5
|
5.10.226
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.167
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
6.1.110
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.51
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.10.10
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.11:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.11:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.11:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.11:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.11:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.11:rc6:*:*:*:*:*:*
|
— | — |