В ядре Linux устранена следующая уязвимость:
usbip: vudc: исправлена ошибка использования после бесплатного использования в vudc_remove из-за состояния гонки. Этот патч является продолжением отчета Чжэн Ванга от 2023 года об использовании после освобождения в
vudc_remove(). Первоначальная тема застопорилась из-за запроса Шуа Хана о
тестирование пути отключения/отсоединения во время выполнения.
Этот патч предоставляет это
тестирование и сохраняет первоначальную форму Чжэна. В vudc_probe() v_init_timer() связывает udc->tr_timer.timer с v_timer().
usbip_sockfd_store() запускает таймер через v_start_timer()/v_kick_timer().
vudc_remove() может затем освободить содержащую структуру vudc, пока таймер
все еще ожидает или выполняется.
KASAN подтверждает гонку на непропатченной гостевой системе QEMU x86_64 с
CONFIG_KASAN=y, CONFIG_USBIP_VUDC=y, CONFIG_USB_ZERO=y и плотный цикл
который неоднократно записывает сокет fd в usbip_sockfd, закрывает сокет
пара и отвязывает/перепривязывает usbip-vudc.0:
ОШИБКА: KASAN: slab-use-after-free в __run_timer_base.part.0+0x8ba/0x8e0
Запись размера 8 по адресу ffff888001b80740 с помощью задачи ignore_and_unb/239. Выделено задачей 239:
vudc_probe+0x4d/0xaa0
Освобожден заданием 239:
kfree+0x18f/0x520
device_release_driver_internal+0x388/0x540
unbind_store+0xd9/0x100
Это попадает в ядро таймера, а не в сам v_timer(), потому что
встроенный timer_list обрабатывается после того, как содержащая его структура vudc была
уже освобожден.
Основная ошибка жизни та же, что и у Чжэна.
сообщил. С вызовом v_stop_timer() из vudc_remove() и удалением таймера
синхронно один и тот же жгут выполнил 5000 итераций привязки/отвязки.
без отчета КАСАН.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: usbip: vudc: Fix use after free bug in vudc_remove due to race condition This patch follows up Zheng Wang's 2023 report of a use-after-free in vudc_remove(). The original thread stalled on Shuah Khan's request for runtime testing of the unplug/unbind path. This patch supplies that testing and keeps Zheng's original fix shape. In vudc_probe(), v_init_timer() binds udc->tr_timer.timer to v_timer(). usbip_sockfd_store() starts the timer via v_start_timer()/v_kick_timer(). vudc_remove() can then free the containing struct vudc while the timer is still pending or executing. KASAN confirms the race on an unpatched x86_64 QEMU guest with CONFIG_KASAN=y, CONFIG_USBIP_VUDC=y, CONFIG_USB_ZERO=y, and a tight loop that repeatedly writes a socket fd to usbip_sockfd, closes the socket pair, and unbinds/rebinds usbip-vudc.0: BUG: KASAN: slab-use-after-free in __run_timer_base.part.0+0x8ba/0x8e0 Write of size 8 at addr ffff888001b80740 by task trigger_and_unb/239 Allocated by task 239: vudc_probe+0x4d/0xaa0 Freed by task 239: kfree+0x18f/0x520 device_release_driver_internal+0x388/0x540 unbind_store+0xd9/0x100 This lands in the timer core rather than v_timer() itself because the embedded timer_list is being walked after its containing struct vudc has already been freed. The underlying lifetime bug is the same one Zheng reported. With v_stop_timer() called from vudc_remove() and the timer deleted synchronously, the same harness completed 5000 bind/unbind iterations with no KASAN report.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 12
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.7
|
5.10.259
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.210
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
6.1.176
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.143
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.12.93
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.35
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.0.12
|
|
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:*:*:*:*:*:*
|
— | — |