Skip to contentSkip to conversation

netfilter/xt_sctp: validate the flag_info count

PATCH Applied Wander Lairson Costa 2 participants 2 messages Aug 28, 2023 – Aug 30, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter/xt_sctp: validate the flag_info count

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")
---
 net/netfilter/xt_sctp.c | 2 ++
 1 file changed, 2 insertions(+)
net/netfilter/xt_sctp.c +2 -0
index e8961094a282..b46a6a512058 100644
@@ -149,6 +149,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)
Signature · 1 line
2.41.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Wander Lairson Costa

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.

Applied to nf, thanks