В ядре Linux устранена следующая уязвимость:
ALSA: caiaq: исправлено чтение стека за пределами границ в init_card
Цикл создает копию короткого имени карты без пробелов.
где `len <sizeof(card->id)` используется для проверки границ. Поскольку
sizeof(card->id) равен 16, а буфер локального идентификатора также имеет размер 16 байт,
запись 16 символов без пробелов заполняет весь буфер,
перезапись завершающего нулевого байта. Когда эта строка, не завершающаяся нулем, позже передается в
snd_card_set_id() -> copy_valid_id_string(), функция сканирует
вперед с помощью ` while (*nid && ...)` и читает дальше конца
буфер стека, считывающий содержимое стека.
USB-устройство, название продукта которого содержит множество не-ASCII и пробелов.
символы (например, многобайтовый UTF-8) надежно инициируют это следующим образом:
ОШИБКА: KASAN: стек выходит за границы в copy_valid_id_string.
звук/core/init.c:696 [встроенный]
ОШИБКА: KASAN: стек за пределами границ в snd_card_set_id_no_lock+0x698/0x74c
звук/ядро/init.c:718
Отключение на единицу присутствует с момента фиксации bafeee5b1f8d ("ALSA:
snd_usb_caiaq: дайте лучшее короткое имя") от июня 2009 г. (v2.6.31-rc1),
который впервые представил этот цикл удаления пробелов. Оригинал
код никогда не учитывал нулевой терминатор при ограничении копии. Исправьте это, изменив цикл, привязанный к `sizeof(card->id) - 1`,
обеспечение того, чтобы хотя бы один байт оставался нулевым терминатором.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: ALSA: caiaq: fix stack out-of-bounds read in init_card The loop creates a whitespace-stripped copy of the card shortname where `len < sizeof(card->id)` is used for the bounds check. Since sizeof(card->id) is 16 and the local id buffer is also 16 bytes, writing 16 non-space characters fills the entire buffer, overwriting the terminating nullbyte. When this non-null-terminated string is later passed to snd_card_set_id() -> copy_valid_id_string(), the function scans forward with `while (*nid && ...)` and reads past the end of the stack buffer, reading the contents of the stack. A USB device with a product name containing many non-ASCII, non-space characters (e.g. multibyte UTF-8) will reliably trigger this as follows: BUG: KASAN: stack-out-of-bounds in copy_valid_id_string sound/core/init.c:696 [inline] BUG: KASAN: stack-out-of-bounds in snd_card_set_id_no_lock+0x698/0x74c sound/core/init.c:718 The off-by-one has been present since commit bafeee5b1f8d ("ALSA: snd_usb_caiaq: give better shortname") from June 2009 (v2.6.31-rc1), which first introduced this whitespace-stripping loop. The original code never accounted for the null terminator when bounding the copy. Fix this by changing the loop bound to `sizeof(card->id) - 1`, ensuring at least one byte remains as the null terminator.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 13
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
2.6.31
|
5.10.253
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.203
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
6.1.168
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.134
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.12.81
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.22
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
6.19.12
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.0:rc6:*:*:*:*:*:*
|
— | — |