Zephyr
Пайдаланушы режиміндегі ағын EEPROM API-іне теріс ығысу беру арқылы ядро жадын оқып, қайта жаза алады.
Түйіндемені дереккөздер негізінде ЖИ жасаған және ол автоматты түрде аударылған.
Тек CONFIG_USERSPACE қосылған және пайдаланушы ағынына CONFIG_EEPROM_SIMULATOR құрылғы нысаны берілген Zephyr құрастырылымдарына әсер етеді. 4.3.2 және 4.5.0 нұсқаларында түзетілген.
Ядро жадының буфер шегінен тыс оқылуы шақырушыға қайтарылады және шақырушы берген байттардың ядро жадына буфер шегінен тыс жазылуы ядро күйінің бұзылуына және пайдаланушы режиміндегі сэндбокстан шығуға мүмкіндік береді.
Түзетілген нұсқалар: 4.3.24.5.0
| zephyr | бастап 2.2.0 → түзетілді 4.3.2 бастап 4.4.0 → түзетілді 4.5.0 |
Пайдаланушы кеңістігі қосылған және модельденген EEPROM (qemu_x86, native_sim немесе devicetree арқылы қосылған sim EEPROM) бар Zephyr 2.2.0-ден 4.3.x немесе 4.4.x нұсқаларын пайдаланатын командалар.
Таңбалы ығысу модельденген 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 мәндерін және бастапқы ағашындағы нұсқасын қараңыз.
4.3 желісінде Zephyr 4.3.2 нұсқасына немесе 4.5 желісінде 4.5.0 нұсқасына жаңартыңыз. Кеңес беруде айналып өту жолы аталмаған.
Түпнұсқа тақырып: 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.