In the Linux kernel, the following vulnerability has been resolved: wifi: wilc1000: fix out-of-bounds read in P2P public action frames wilc_wfi_p2p_rx() and mgmt_tx() start parsing a frame once ieee80211_is_public_action() returns true. Этот помощник только проверяет, что кадр достаточно длинный для поля категории действия, то есть offsetofend(struct ieee80211_mgmt, u.action.category), 25 байт. Затем обе функции считывают заголовок публичного действия P2P до oui_subtype при смещении 30 и передают «size - ie_offset» cfg80211_find_vendor_ie(), где ie_offset является офсетом(struct ieee80211_mgmt, u) + sizeof(*d), т.е. 32.
Кадр публичного действия от 25 до 31 байта проходит проверку, но короче, чем заголовок 32 байта, поэтому oui_subtype можно считывать за пределами, и, поскольку длина не подписана, "size - ie_offset" течет до значения, близкого к 4 GiB. cfg80211_find_vendor_ie() принимает неподписанную длину int, поэтому даже значение size_t вычитано в mgmt_tx() Затем он проходит далеко за буфером в поисках элемента поставщика, пока не достигнет неотображенной памяти. На пути приема кадр прибывает по воздуху и не нуждается в ассоциации, поэтому соседнее неаутентифицированное устройство может сбить хост, пока он находится в P2P. Отклоните кадры короче, чем заголовок публичного действия P2P в обоих направлениях, прежде чем отбрасывать его.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: wifi: wilc1000: fix out-of-bounds read in P2P public action frames wilc_wfi_p2p_rx() and mgmt_tx() start parsing a frame once ieee80211_is_public_action() returns true. That helper only verifies the frame is long enough for the action category field, that is offsetofend(struct ieee80211_mgmt, u.action.category), 25 bytes. Both functions then read the P2P public action header up to oui_subtype at offset 30 and pass "size - ie_offset" to cfg80211_find_vendor_ie(), where ie_offset is offsetof(struct ieee80211_mgmt, u) + sizeof(*d), i.e. 32. A public action frame of 25 to 31 bytes passes the check but is shorter than that 32 byte header, so oui_subtype can be read out of bounds, and because the length is unsigned, "size - ie_offset" underflows to a value close to 4 GiB. cfg80211_find_vendor_ie() takes an unsigned int length, so even the size_t subtraction in mgmt_tx() is truncated to the same value. It then walks far past the buffer searching for a vendor element until it reaches unmapped memory. In the receive path the frame arrives over the air and needs no association, so a nearby unauthenticated device can crash the host while it is in P2P listen. Reject frames shorter than the P2P public action header in both paths before dereferencing it.