В ядре Linux устранена следующая уязвимость:
scsi: scsi_debug: исправлено чтение за пределами границ в resp_report_tgtpgs(). При запуске syzkaller наблюдалась следующая проблема:
ОШИБКА: KASAN: плита выходит за границы в memcpy include/linux/string.h:377 [inline]
ОШИБКА: KASAN: плита выходит за пределы в sg_copy_buffer+0x150/0x1c0 lib/scatterlist.c:831
Чтение размера 2132 по адресу ffff8880aea95dc8 с помощью задачи syz-executor.0/9815. ЦП: 0 PID: 9815 Связь: syz-executor.0 Не испорчен 4.19.202-00874-gfc0fe04215a9 #2
Название оборудования: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 от 01.04.2014
Отслеживание вызова:
__dump_stack lib/dump_stack.c:77 [встроенный]
dump_stack+0xe4/0x14a lib/dump_stack.c:118
print_address_description+0x73/0x280 мм/kasan/report.c:253
kasan_report_error мм/kasan/report.c:352 [встроенный]
kasan_report+0x272/0x370 мм/kasan/report.c:410
memcpy+0x1f/0x50 мм/kasan/kasan.c:302
memcpy include/linux/string.h:377 [встроенный]
sg_copy_buffer+0x150/0x1c0 lib/scatterlist.c:831
fill_from_dev_buffer+0x14f/0x340 driver/scsi/scsi_debug.c:1021
resp_report_tgtpgs+0x5aa/0x770 driver/scsi/scsi_debug.c:1772
Schedule_resp+0x464/0x12f0 driver/scsi/scsi_debug.c:4429
scsi_debug_queuecommand+0x467/0x1390 driver/scsi/scsi_debug.c:5835
scsi_dispatch_cmd+0x3fc/0x9b0 driver/scsi/scsi_lib.c:1896
scsi_request_fn+0x1042/0x1810 драйверы/scsi/scsi_lib.c:2034
__blk_run_queue_uncond блок/blk-core.c:464 [встроенный]
__blk_run_queue+0x1a4/0x380 блок/blk-core.c:484
blk_execute_rq_nowait+0x1c2/0x2d0 блок/blk-exec.c:78
sg_common_write.isra.19+0xd74/0x1dc0 драйверы/scsi/sg.c:847
sg_write.part.23+0x6e0/0xd00 драйверы/scsi/sg.c:716
sg_write+0x64/0xa0 драйверы/scsi/sg.c:622
__vfs_write+0xed/0x690 fs/read_write.c:485
kill_bdev:block_device:00000000e138492c
vfs_write+0x184/0x4c0 fs/read_write.c:549
ksys_write+0x107/0x240 фс/read_write.c:599
do_syscall_64+0xc2/0x560 Arch/x86/entry/common.c:293
запись_SYSCALL_64_after_hwframe+0x49/0xbe
Мы получаем «ален» из команды, ее тип — int.
Если пользовательское пространство проходит большой length мы получим отрицательное значение «alen». Переключите n, alen и rlen на u32.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: scsi: scsi_debug: Fix out-of-bound read in resp_report_tgtpgs() The following issue was observed running syzkaller: BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline] BUG: KASAN: slab-out-of-bounds in sg_copy_buffer+0x150/0x1c0 lib/scatterlist.c:831 Read of size 2132 at addr ffff8880aea95dc8 by task syz-executor.0/9815 CPU: 0 PID: 9815 Comm: syz-executor.0 Not tainted 4.19.202-00874-gfc0fe04215a9 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xe4/0x14a lib/dump_stack.c:118 print_address_description+0x73/0x280 mm/kasan/report.c:253 kasan_report_error mm/kasan/report.c:352 [inline] kasan_report+0x272/0x370 mm/kasan/report.c:410 memcpy+0x1f/0x50 mm/kasan/kasan.c:302 memcpy include/linux/string.h:377 [inline] sg_copy_buffer+0x150/0x1c0 lib/scatterlist.c:831 fill_from_dev_buffer+0x14f/0x340 drivers/scsi/scsi_debug.c:1021 resp_report_tgtpgs+0x5aa/0x770 drivers/scsi/scsi_debug.c:1772 schedule_resp+0x464/0x12f0 drivers/scsi/scsi_debug.c:4429 scsi_debug_queuecommand+0x467/0x1390 drivers/scsi/scsi_debug.c:5835 scsi_dispatch_cmd+0x3fc/0x9b0 drivers/scsi/scsi_lib.c:1896 scsi_request_fn+0x1042/0x1810 drivers/scsi/scsi_lib.c:2034 __blk_run_queue_uncond block/blk-core.c:464 [inline] __blk_run_queue+0x1a4/0x380 block/blk-core.c:484 blk_execute_rq_nowait+0x1c2/0x2d0 block/blk-exec.c:78 sg_common_write.isra.19+0xd74/0x1dc0 drivers/scsi/sg.c:847 sg_write.part.23+0x6e0/0xd00 drivers/scsi/sg.c:716 sg_write+0x64/0xa0 drivers/scsi/sg.c:622 __vfs_write+0xed/0x690 fs/read_write.c:485 kill_bdev:block_device:00000000e138492c vfs_write+0x184/0x4c0 fs/read_write.c:549 ksys_write+0x107/0x240 fs/read_write.c:599 do_syscall_64+0xc2/0x560 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe We get 'alen' from command its type is int. If userspace passes a large length we will get a negative 'alen'. Switch n, alen, and rlen to u32.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 2
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
— |
5.10.82
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.5
|