netfilter: xt_sctp: validate the flag_info count
authorWander Lairson Costa <wander@redhat.com>
Mon, 28 Aug 2023 22:12:55 +0000 (19:12 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:59 +0000 (09:42 +0200)
commit4921f9349b66da7c5a2b6418fe45e9ae0ae72924
treef0e3c95b199a3151a9d839bc286c39526ba3d6b1
parent1c164c1e9e93b0a72a03a7edb754e3857d4e4302
netfilter: xt_sctp: validate the flag_info count

commit e99476497687ef9e850748fe6d232264f30bc8f9 upstream.

sctp_mt_check doesn't validate the flag_count field. An attacker can
take advantage of that to trigger a OOB read and leak memory
information.

Add the field validation in the checkentry function.

Fixes: 2e4e6a17af35 ("[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables")
Cc: stable@vger.kernel.org
Reported-by: Lucas Leong <wmliang@infosec.exchange>
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/xt_sctp.c