Zephyr's IPv6, IPv4 and IEEE 802.15.4 (6LoWPAN) fragment reassembly implementations each keep a global reassembly cache that two threads modify with no synchronization. In the IPv6 code in subsys/net/ip/ipv6_fragment.c, the receive path runs net_ipv6_handle_fragment_hdr() and reassemble_packet(), and the reassembly_timeout() delayable-work handler runs on the system workqueue. When a datagram completes, reassemble_packet() calls only the non-synchronous k_work_cancel_delayable(), which does not stop a timeout handler that is already running. Separately, reassembly_get() treats a slot as free as soon as its timer is no longer pending, even while that slot's handler is still running. The IPv4 code in subsys/net/ip/ipv4_fragment.c has the same structure. In the 6LoWPAN code in subsys/net/l2/ieee802154/ieee802154_6lo_fragment.c, the reass_timeout() handler frees a cache entry's packet and releases the entry while fragment_add_to_cache() on the receive path may still be using it, and set_reass_cache() re-initializes the entry's timer on every allocation.
A remote, unauthenticated attacker who can send fragmented packets to a device built with CONFIG_NET_IPV6_FRAGMENT, CONFIG_NET_IPV4_FRAGMENT or CONFIG_NET_L2_IEEE802154_FRAGMENT (for 6LoWPAN, from within IEEE 802.15.4 radio range) can time fragments around the reassembly timeout. In the IPv6 code two interleavings are reachable. In the first, the timeout handler frees the stored fragments with reassembly_cancel() while the receive path is still merging them. In the second, the receive path reuses the slot and frees a stale first fragment while the handler is blocked inside net_icmpv6_send_error() still using that fragment as the source of the ICMPv6 Time Exceeded message. The race is widest with preemptive network threads, driver-context receive processing, or SMP. With the default cooperative threads on a single core, the attacker needs the handler to block while allocating a buffer.
Winning the race causes use-after-free, double free of net_pkt objects, or a NULL pointer dereference in the network receive or workqueue thread. The typical result is a crash, which is a remote denial of service. The fixes add a mutex to each implementation that serializes its cache between the receive path and the timeout handler (and, for IPv6 and IPv4, the slot iterator net_ipv6_frag_foreach() / net_ipv4_frag_foreach()), and make a handler whose entry was released or reused while it waited leave that entry alone. The IPv6 fix also detaches the first fragment before sending the ICMPv6 error, and the 6LoWPAN fix initializes the entry timers once instead of on every allocation.
Bu kayıt NIST NVD kaynağından aktarılmıştır. Etkilenen sürümler, güncel değerlendirme ve üretici referansları için kaynak kaydı inceleyin.

