ethernet_recv() в subsys/net/l2/ethernet/ethernet.c проверяет только то, что первый net_buf принятого кадра содержит простую 14-байтовую структуру net_eth_hdr. Когда эфирный тип 0x8100 и VLAN включен на интерфейсе, тот же буфер интерпретируется как 18-байтная структура net_eth_vlan_hdr без повторной проверки длины: VLAN TCI и внутренний эфирный тип считываются со смещений 14.17, мимо pkt->buffer->len, а hdr_len повышается до 18, поэтому последующий net_buf_pull () удаляет больше байт, чем буфер. Один неаутентифицированный кадр от 14 до 17 байт, несущий эфирный тип VLAN, запускает это.
Знания о конфигурации узла VLAN не требуются: net_eth_get_vlan_iface () возвращает базовый интерфейс для приоритетного тега 0, а адрес назначения вещания удовлетворяет тесту «кадр для меня», поэтому 16-байтный широковещательный кадр с эфирным типом 0x8100 и TCI 0x0000 достигает вытягивания. Ничто в пути приема не обеспечивает 60-байтный минимум Ethernet - классы гаджетов USB CDC ECM и CDC NCM, в частности, кадры с ручным хостом любой ненулевой длины прямо в net_recv_data (). С включенными утверждениями net_buf_simple_pull () утверждает, и узел паникует.
В производственной сборке (утверждения и CONFIG_NET_BUF_HARDENING выключены) длина буфера uint16_t уменьшается до 65534, а buf->data продвигается дальше конца хранилища фрагмента, поэтому каждый последующий анализатор считывает далеко за пределами буфера и любой net_buf_add() на этом фрагменте вычисляет хвостовое отделение из недотекшей длины. Результатом является надежный удаленный отказ в обслуживании и доступ out-of-bounds с раскрытием информации и коррупционным потенциалом. Затрагиваются только конфигурации, построенные с CONFIG_NET_VLAN=y, которые имеют VLAN, включенный на принимающем интерфейсе Ethernet, и чей MAC не снимает теги VLAN в аппаратном обеспечении (ETHERNET_HW_VLAN_TAG_STRIP).
Исправление отклоняет кадр перед чтением тега, поэтому hdr_len после этого составляет либо 14, либо 18 с обоими размерами, подтвержденными против pkt->buffer->len.
Показать оригинальное описание (EN)
ethernet_recv() in subsys/net/l2/ethernet/ethernet.c validates only that the first net_buf of a received frame holds a plain 14-byte struct net_eth_hdr. When the ethertype is 0x8100 and VLAN is enabled on the interface, the same buffer is reinterpreted as the 18-byte struct net_eth_vlan_hdr without re-checking the length: the VLAN TCI and the inner ethertype are read from offsets 14..17, past pkt->buffer->len, and hdr_len is raised to 18 so the subsequent net_buf_pull() removes more bytes than the buffer holds. A single unauthenticated frame of 14 to 17 bytes carrying the VLAN ethertype triggers this. No knowledge of the node's VLAN configuration is needed: net_eth_get_vlan_iface() returns the base interface for the priority tag 0, and a broadcast destination address satisfies the "frame is for me" test, so a 16-byte broadcast frame with ethertype 0x8100 and TCI 0x0000 reaches the pull. Nothing in the receive path enforces the 60-byte Ethernet minimum — the USB CDC ECM and CDC NCM gadget classes in particular hand host-supplied frames of any non-zero length straight to net_recv_data(). With assertions enabled, net_buf_simple_pull() asserts and the node panics. In a production build (assertions and CONFIG_NET_BUF_HARDENING off) the uint16_t buffer length underflows to 65534 and buf->data is advanced past the end of the fragment's storage, so every later parser reads far outside the buffer and any net_buf_add() on that fragment computes tailroom from the underflowed length. The result is a reliable remote denial of service and out-of-bounds access with information-disclosure and corruption potential. Only configurations built with CONFIG_NET_VLAN=y that have a VLAN enabled on the receiving Ethernet interface, and whose MAC does not strip VLAN tags in hardware (ETHERNET_HW_VLAN_TAG_STRIP), are affected. The fix rejects the frame before the tag is read, so hdr_len is thereafter either 14 or 18 with both sizes validated against pkt->buffer->len.
Характеристики атаки
Последствия
Строка CVSS v3.1