diff options
author | Wander Lairson Costa <wander@redhat.com> | 2023-08-28 19:12:55 -0300 |
---|---|---|
committer | Lee Jones <joneslee@google.com> | 2023-10-18 15:51:50 +0100 |
commit | 1d8dd603291f79510c2bd68bf52183218801d5a4 (patch) | |
tree | ba315923423c12d2d0d23e308c391aaf1940e8c5 | |
parent | e1020a2af01db9b72b09ee7437dab74e1a7e7878 (diff) | |
download | common-1d8dd603291f79510c2bd68bf52183218801d5a4.tar.gz |
UPSTREAM: 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.
Bug: 304913898
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>
(cherry picked from commit 4921f9349b66da7c5a2b6418fe45e9ae0ae72924)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ife4e69f6218fdaca2a8647b5ed00d875a5ed0d34
-rw-r--r-- | net/netfilter/xt_sctp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c index 680015ba7cb6..d4bf089c9e3f 100644 --- a/net/netfilter/xt_sctp.c +++ b/net/netfilter/xt_sctp.c @@ -150,6 +150,8 @@ static int sctp_mt_check(const struct xt_mtchk_param *par) { const struct xt_sctp_info *info = par->matchinfo; + if (info->flag_count > ARRAY_SIZE(info->flag_info)) + return -EINVAL; if (info->flags & ~XT_SCTP_VALID_FLAGS) return -EINVAL; if (info->invflags & ~XT_SCTP_VALID_FLAGS) |