В ядре Linux устранена следующая уязвимость:
Ввод: cs40l50-vibra — проверка пользовательских данных из пользовательского пространства.
cs40l50_add() копирует пользовательские данные эффекта FF_PERIODIC/FF_CUSTOM.
прямо из ff_effect, который пользователь передал в EVIOCSFF, без
требуя, чтобы он содержал что-либо:
work_data.custom_data = memdup_array_user(периодические->custom_data,
периодический->custom_len,
размер(s16));
work_data.custom_len = периодическое->custom_len;
Затем драйвер считывает из этого буфера два слова: custom_data[0] в качестве
банк сигналов в cs40l50_effect_bank_set() и custom_data[1] в качестве
индекс внутри банка в cs40l50_effect_index_set(). Ни одно чтение не является
покрывается проверкой длины, а custom_len полностью контролируется пользователем:
- custom_len == 0 заставляет memdup_array_user() вызывать memdup_user() с
длина равна нулю, что возвращает ZERO_SIZE_PTR, а не ошибку, поэтому
custom_data[0] разыменовывает его.
- custom_len == 1 выделяет два байта. Банк ПЗУ или ОЗУ хранит
effect->type из регистра OWT, а затем считывается custom_data[1]
слово мимо выделения.
Сама стоимость банка также неправильно обрабатывается. Он замаскирован с помощью
CS40L50_CUSTOM_DATA_MASK (0xffff), но хранится в s16, поэтому
custom_data[0] со значением 0x8000 или выше преобразуется в отрицательное значение, которое проходит
тест «bank_type >= CS40L50_WVFRM_BANK_NUM».
cs40l50_effect_index_set() индексирует vib->dsp.banks[] перед
случай по умолчанию в операторе переключения получает возможность его отклонить:
base_index = vib->dsp.banks[эффект->тип].base_index;
max_index = vib->dsp.banks[эффект->тип].max_index;
Требуйте присутствия двух слов, которые читает водитель, и удерживайте замаскированную
банк в u32, поэтому существующий тест верхней границы охватывает весь диапазон. Тактильный драйвер da7280 уже проверяет диапазон custom_len таким образом.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: Input: cs40l50-vibra - validate custom data from user space cs40l50_add() copies the custom data of an FF_PERIODIC/FF_CUSTOM effect straight from the ff_effect the user passed to EVIOCSFF, without requiring it to hold anything: work_data.custom_data = memdup_array_user(periodic->custom_data, periodic->custom_len, sizeof(s16)); work_data.custom_len = periodic->custom_len; The driver then reads two words out of that buffer: custom_data[0] as the waveform bank in cs40l50_effect_bank_set(), and custom_data[1] as the index within the bank in cs40l50_effect_index_set(). Neither read is covered by a length check, and custom_len is fully user controlled: - custom_len == 0 makes memdup_array_user() call memdup_user() with a length of zero, which returns ZERO_SIZE_PTR rather than an error, so custom_data[0] dereferences it. - custom_len == 1 allocates two bytes. A bank of ROM or RAM keeps effect->type out of the OWT case, and custom_data[1] is then read one word past the allocation. The bank value itself is also mishandled. It is masked with CS40L50_CUSTOM_DATA_MASK (0xffff) but stored in an s16, so a custom_data[0] of 0x8000 or above wraps to a negative value that passes the "bank_type >= CS40L50_WVFRM_BANK_NUM" test. cs40l50_effect_index_set() indexes vib->dsp.banks[] with it before the switch statement's default case gets a chance to reject it: base_index = vib->dsp.banks[effect->type].base_index; max_index = vib->dsp.banks[effect->type].max_index; Require the two words the driver reads to be present, and hold the masked bank in a u32 so the existing upper-bound test covers the whole range. The da7280 haptic driver already range checks custom_len this way.
Характеристики атаки
Последствия
Строка CVSS v3.1
Уязвимые продукты 4
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.11
|
6.12.105
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.11
|
6.18.46
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.11
|
7.1.10
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.11
|
7.2
|