linux/net/ipv6/netfilter
Zhengchuan Liang 4322dcde6b netfilter: ip6t_hbh: reject oversized option lists
struct ip6t_opts stores at most IP6T_OPTS_OPTSNR option descriptors,
but hbh_mt6_check() does not reject larger optsnr values supplied from
userspace.

Validate optsnr in the rule setup path so only match data that fits the
fixed-size opts array can be installed. This follows the existing xtables
pattern of rejecting invalid user-provided counts in checkentry() and
keeps the packet matching path unchanged.

`struct ip6t_opts` has a fixed `opts[IP6T_OPTS_OPTSNR]` array,
where `IP6T_OPTS_OPTSNR` is 16, then off-by-one array access is possible:

[  137.924693][ T8692] UBSAN: array-index-out-of-bounds in ../net/ipv6/netfilter/ip6t_hbh.c:110:29
[  137.926167][ T8692] index 16 is out of range for type '__u16 [16]'

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@kernel.org
Reported-by: Yuan Tan <yuantan098@gmail.com>
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Signed-off-by: Zhengchuan Liang <zcliangcn@gmail.com>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
History 2026-05-16 13:21:41 +02:00
..
ip6_tables.c netfilter: x_tables: add and use xtables_unregister_table_exit 2026-05-08 01:30:16 +02:00
ip6t_ah.c netfilter: ip6tables: Remove redundant null checks 2020-07-29 20:39:43 +02:00
ip6t_eui64.c netfilter: require Ethernet MAC header before using eth_hdr() 2026-04-10 12:16:27 +02:00
ip6t_frag.c netfilter: ip6tables: Remove redundant null checks 2020-07-29 20:39:43 +02:00
ip6t_hbh.c netfilter: ip6t_hbh: reject oversized option lists 2026-05-16 13:21:41 +02:00
ip6t_ipv6header.c netfilter: move inline nf_ip6_ext_hdr() function to a more appropriate header. 2019-09-13 12:34:09 +02:00
ip6t_mh.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ip6t_NPT.c netfilter: ip6t_NPT: rewrite addresses in ICMPv6 original packet 2020-08-28 19:18:48 +02:00
ip6t_REJECT.c netfilter: use actual socket sk for REJECT action 2020-12-01 14:33:55 +01:00
ip6t_rpfilter.c netfilter: ip6t_rpfilter: Fix regression with VRF interfaces 2023-02-22 00:22:20 +01:00
ip6t_rt.c netfilter: ip6t_rt: reject oversized addrnr in rt_mt6_check() 2026-03-26 13:18:31 +01:00
ip6t_srh.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ip6t_SYNPROXY.c netfilter: Add MODULE_DESCRIPTION entries to kernel modules 2020-06-25 00:50:31 +02:00
ip6table_filter.c netfilter: x_tables: close dangling table module init race 2026-05-08 01:30:17 +02:00
ip6table_mangle.c netfilter: x_tables: close dangling table module init race 2026-05-08 01:30:17 +02:00
ip6table_nat.c netfilter: x_tables: add and use xtables_unregister_table_exit 2026-05-08 01:30:16 +02:00
ip6table_raw.c netfilter: x_tables: close dangling table module init race 2026-05-08 01:30:17 +02:00
ip6table_security.c netfilter: x_tables: close dangling table module init race 2026-05-08 01:30:17 +02:00
Kconfig netfilter: add back NETFILTER_XTABLES dependencies 2025-08-07 13:19:25 +02:00
Makefile netfilter: xtables: allow xtables-nft only builds 2024-01-29 15:43:21 +01:00
nf_conntrack_reasm.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
nf_defrag_ipv6_hooks.c netfilter: add missing module descriptions 2023-11-08 13:52:32 +01:00
nf_dup_ipv6.c ipv6: adopt dst_dev() helper 2025-07-02 14:32:30 -07:00
nf_reject_ipv6.c netfilter: nf_reject: don't reply to icmp error messages 2025-09-11 15:40:55 +02:00
nf_socket_ipv6.c netfilter: nf_socket: skip socket lookup for non-first fragments 2026-04-30 17:59:01 +02:00
nf_tproxy_ipv6.c tcp: Don't pass hashinfo to socket lookup helpers. 2025-08-25 17:53:35 -07:00
nft_dup_ipv6.c netfilter: nf_tables: remove register tracking infrastructure 2026-02-25 19:36:26 -08:00
nft_fib_ipv6.c netfilter: nft_fib_ipv6: switch to fib6_lookup 2026-03-04 11:45:44 +01:00
nft_reject_ipv6.c netfilter: nf_tables: remove register tracking infrastructure 2026-02-25 19:36:26 -08:00