Zephyr
Поток пользовательского режима может читать и перезаписывать память ядра, передавая отрицательное смещение в API EEPROM.
Резюме сгенерировано ИИ по данным источников и переведено автоматически.
Затрагивает только сборки Zephyr с включённым CONFIG_USERSPACE и экземпляром устройства CONFIG_EEPROM_SIMULATOR, объект которого предоставлен пользовательскому потоку. Исправлено в 4.3.2 и 4.5.0.
Чтение за пределами буфера памяти ядра, возвращаемое вызывающей стороне, и запись за пределами буфера предоставленных вызывающей стороной байтов поверх памяти ядра, что позволяет повредить состояние ядра и выйти из изолированной среды пользовательского режима.
Исправлено в версиях: 4.3.24.5.0
| zephyr | с 2.2.0 → исправлено в 4.3.2 с 4.4.0 → исправлено в 4.5.0 |
Команды, использующие Zephyr с версии 2.2.0 по 4.3.x или 4.4.x с включённой поддержкой пользовательского пространства и симулированной EEPROM (qemu_x86, native_sim или sim EEPROM, добавленная через дерево устройств).
Отрицательное смещение со знаком обходит проверку границ в драйвере симулированной EEPROM. Это позволяет коду пользовательского режима читать память .bss ядра в свой буфер и записывать предоставленные вызывающей стороной байты поверх памяти ядра, что может повредить состояние ядра и выйти из изолированной среды пользовательского режима.
Zephyr с 2.2.0 до, не включая, 4.3.2, и с 4.4.0 до, не включая, 4.5.0. Для настройки требуется CONFIG_USERSPACE=y, экземпляр устройства CONFIG_EEPROM_SIMULATOR и предоставление этого объекта устройства пользовательскому потоку. Чтобы проверить сборку, посмотрите значения CONFIG_USERSPACE и CONFIG_EEPROM_SIMULATOR в её конфигурации и версию в её дереве исходного кода.
Обновитесь до Zephyr 4.3.2 на ветке 4.3 или до 4.5.0 на ветке 4.5. В рекомендациях не указано обходных решений.
Оригинальный заголовок: Zephyr out-of-bounds write in simulated EEPROM driver
The simulated EEPROM driver validated access ranges in eeprom_range_is_valid() (drivers/eeprom/eeprom_simulator.c) with a single test, (offset + len) <= config->size. Because offset is a signed off_t and len an unsigned size_t of the same rank, the addition is evaluated in unsigned arithmetic: a negative offset combined with a compensating len wraps the sum back into the accepted range. eeprom_sim_read() and eeprom_sim_write() then memcpy() through the EEPROM(addr) macro, which is plain pointer arithmetic on the driver's static mock_eeprom array, so the copy addresses memory located before that array. eeprom_read() and eeprom_write() are __syscall entry points, and their verification handlers in drivers/eeprom/eeprom_handlers.c check only the device object and the caller's own data buffer (K_SYSCALL_MEMORY_READ/K_SYSCALL_MEMORY_WRITE) — the offset argument is passed to the driver unvalidated. With CONFIG_USERSPACE=y, a CONFIG_EEPROM_SIMULATOR device instance, and the device object granted to a user thread (the usage the in-tree tests/drivers/eeprom/api suite exercises from ZTEST_USER threads), an unprivileged thread could supply a negative offset and have the kernel perform the copy on its behalf. The result is an out-of-bounds read of kernel .bss returned into the caller's buffer and, via the write path, an out-of-bounds write of caller-supplied bytes over kernel memory preceding mock_eeprom. Both the start address and the length of the affected span are attacker-selected, so the primitive is sufficient to corrupt adjacent kernel state and escape the user-mode sandbox. Exposure is limited to builds that instantiate the simulated EEPROM (status = "okay" by default on qemu_x86 and native_sim, otherwise added by a devicetree overlay) together with userspace isolation. The fix rejects negative offsets and performs the remaining bound check without overflow.