В ядре Linux устранена следующая уязвимость:
usb: usbfs: исправлено использование после освобождения usb_device в usbdev_release()
usbdev_release() удаляет ссылку на структуру usb_device перед
слив списка завершенных асинхронных URB, но этот путь стока считывает обратно
через тот же объект: free_async() вызывает dec_usb_memory_use_count()
для любого URB, буфер которого получен из региона usbfs mmap(), и его первый
оператор bus_to_hcd(ps->dev->bus). После отключения ссылка на usbfs может быть последней, в этом случае
usb_put_dev() освобождает устройство, и последующий цикл считывает смещение 80 от
освобождает память и использует результат как структуру usb_hcd*, которая
hcd_buffer_free_pages() затем разыменовывает. Это доступно непривилегированному процессу, имеющему доступ на чтение/запись к
узел /dev/bus/usb: mmap() fd, отправьте один URB с буфером внутри
сопоставление, дождитесь отключения устройства, затем munmap() и close().
Он размножается при каждой попытке, а не является расой, потому что живой
MAP_SHARED vma содержит ссылку на файл структуры, поэтому usbdev_release()
не может работать до тех пор, пока не исчезнет последняя vma и не освободится ветка
dec_usb_memory_use_count() всегда используется. ОШИБКА: KASAN: slab-use-after-free в dec_usb_memory_use_count+0x3ae/0x410
Чтение размера 8 по адресу ffff8880122ee050 с помощью задачи poc/769. ЦП: 1 UID: 1000 PID: 769 Связь: poc Испорченный: GB 6.12.94 #3
Отслеживание вызова:
dec_usb_memory_use_count+0x3ae/0x410
free_async+0x2aa/0x4f0
usbdev_release+0x375/0x460
__fput+0x3ea/0xb50
__x64_sys_close+0x86/0x100
Выделено по заданию 11:
usb_alloc_dev+0x55/0xd90
Hub_event+0x2524/0x43d0
Освобожден заданием 769:
kсвобод+0x121/0x360
device_release+0xd2/0x280
usb_put_dev+0x23/0x30
usbdev_release+0x2d8/0x460
Вместо этого отпустите ссылку на устройство после контура стока.
Ничего между два пункта требуют, чтобы он был исключен.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: usb: usbfs: fix use-after-free of usb_device in usbdev_release() usbdev_release() drops its reference to the struct usb_device before draining the list of completed async URBs, but that drain path reads back through the same object: free_async() calls dec_usb_memory_use_count() for any URB whose buffer came from the usbfs mmap() region, and its first statement is bus_to_hcd(ps->dev->bus). After a disconnect the usbfs reference can be the last one, in which case usb_put_dev() frees the device and the subsequent loop reads offset 80 of freed memory and uses the result as a struct usb_hcd *, which hcd_buffer_free_pages() then dereferences. This is reachable by an unprivileged process that has read/write access to a /dev/bus/usb node: mmap() the fd, submit one URB with a buffer inside the mapping, wait for the device to be unplugged, then munmap() and close(). It reproduces on every attempt rather than being a race, because a live MAP_SHARED vma holds a reference on the struct file, so usbdev_release() cannot run until the last vma is gone and the freeing branch of dec_usb_memory_use_count() is always taken. BUG: KASAN: slab-use-after-free in dec_usb_memory_use_count+0x3ae/0x410 Read of size 8 at addr ffff8880122ee050 by task poc/769 CPU: 1 UID: 1000 PID: 769 Comm: poc Tainted: G B 6.12.94 #3 Call Trace: dec_usb_memory_use_count+0x3ae/0x410 free_async+0x2aa/0x4f0 usbdev_release+0x375/0x460 __fput+0x3ea/0xb50 __x64_sys_close+0x86/0x100 Allocated by task 11: usb_alloc_dev+0x55/0xd90 hub_event+0x2524/0x43d0 Freed by task 769: kfree+0x121/0x360 device_release+0xd2/0x280 usb_put_dev+0x23/0x30 usbdev_release+0x2d8/0x460 Release the device reference after the drain loop instead. Nothing between the two points requires it to have been dropped.