Драйвер Espressif ESP-размещен в Wi-Fi (drivers/wifi/esp_hosted/) анализирует кадры, полученные через SPI от сопроцессора ESP в esp_hosted_event_task(). Для управляющих кадров он взял 16-битное поле TLV data_length прямо с провода и передал его pb_istream_from_buffer(frame.data_value, frame.data_length), не проверяя его по длине кадра или буферу приема. frame.data_value размещает 26 байт в объекте стека 3188 байт, поэтому data_length до 0xFFFF делает pb_decode () читать примерно до 62 KB мимо конца этого объекта. Только первый фрагмент фрагмент ответа фрагментированного управления несёт заголовок TLV; драйвер pre-fix выполнял полудуплексные транзакции SPI и молча отбрасывал любой кадр, который сопроцессор выстраивал в очередь, пока хост передавал (esp_hosted_hal_spi_transfer() псевдоним RX буфер на буфер TX).
Когда выброшенный кадр является первым фрагментом фрагментированного ответа, драйвер обрабатывает следующий фрагмент как новый кадр — его заголовок для фрагмента и контрольная сумма являются подлинными, поэтому оба шага проверки проходят — и считывает заголовок TLV из необработанных байтов продолжения protobuf. Эти байты поступают из контрольных ответов, на размер и содержание которых может повлиять соседний, не аутентифицированный злоумышленник, в частности, список сканирования AP, который растет с увеличением количества и длины точек доступа SSID в радиодиапазоне. Результатом является отказ в обслуживании, а не раскрытие.
Чтение после конца области RAM приводит к сбоям устройства, а CONFIG_NANOPB_ENABLE_MALLOC выбирается драйвером, поэтому префиксы длины мусора, читаемые за пределами, также приводят к выделению куч. Сами байты out-of-bounds не доходят до приложения: pb_decode() запускается в середине потока на необработанных байтах продолжения protobuf и поэтому почти всегда терпит неудачу сразу, и все, что декодировалось, все равно должно было пройти esp_hosted_response(), что требует точного соответствия msg_id против ожидающего запроса, а затем esp_hosted_ctrl_response(), что требует успешного ответа - злоумышленник влияет на размер и содержание законных контрольных ответов, а не декодируется. Два связанных дефекта в одном и том же пути приема делают отказ в обслуживании постоянным: предохранитель повторной сборки фрагмента был размером с ESP_FRAME_SIZE вместо ESP_FRAME_MAX_PAYLOAD и при срабатывании возвращался из единственного потока RX вместо падения кадра, а неуправляемые управляющие события стояли в очереди с k_msgq_put (..., K_FOREVER) в очереди из восьми входов, что ничто не истощает, блокируя тот же поток.
У водителя нет сторожевого пульта или пути перезапуска, поэтому любое условие прекращает прием Wi-Fi до перезагрузки устройства.
Показать оригинальное описание (EN)
The Espressif ESP-hosted Wi-Fi driver (drivers/wifi/esp_hosted/) parses frames received over SPI from the ESP co-processor in esp_hosted_event_task(). For control frames it took the 16-bit TLV field data_length straight off the wire and passed it to pb_istream_from_buffer(frame.data_value, frame.data_length) without checking it against the frame length or the receive buffer. frame.data_value sits 26 bytes into a 3188-byte stack object, so a data_length of up to 0xFFFF makes pb_decode() read up to roughly 62 KB past the end of that object. Only the first fragment of a fragmented control response carries a TLV header; the pre-fix driver performed half-duplex SPI transactions and silently discarded any frame the co-processor queued while the host was transmitting (esp_hosted_hal_spi_transfer() aliased the RX buffer onto the TX buffer). When the discarded frame is the first fragment of a fragmented response, the driver treats the next fragment as a new frame — its per-fragment header and checksum are genuine, so both validation steps pass — and reads the TLV header out of raw protobuf continuation bytes. Those bytes come from control responses whose size and content an adjacent, unauthenticated attacker can influence, notably the AP scan list, which grows with the number and SSID length of access points in radio range. The impact is denial of service rather than disclosure. Reading past the end of the RAM region faults the device, and CONFIG_NANOPB_ENABLE_MALLOC is selected by the driver, so garbage length prefixes read out of bounds also drive heap allocations. The out-of-bounds bytes themselves do not reach the application: pb_decode() is started mid-stream on raw protobuf continuation bytes and so almost always fails outright, and anything that did decode would still have to pass esp_hosted_response(), which requires an exact msg_id match against the pending request, and then esp_hosted_ctrl_response(), which requires a success resp — an attacker influences the size and content of legitimate control responses, not the structure decoded out of misaligned bytes. Two related defects in the same receive path make the denial of service permanent: the fragment reassembly guard was sized with ESP_FRAME_SIZE instead of ESP_FRAME_MAX_PAYLOAD and, when tripped, returned from the sole RX thread instead of dropping the frame, and unhandled control events were queued with k_msgq_put(..., K_FOREVER) on an eight-entry queue that nothing drains, blocking that same thread. The driver has no watchdog or restart path, so either condition ends all Wi-Fi reception until the device is rebooted.
Характеристики атаки
Последствия
Строка CVSS v3.1