All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sctp: socket.c validate sprstat_policy
@ 2018-10-27 19:58 ` Tomas Bortoli
  0 siblings, 0 replies; 12+ messages in thread
From: Tomas Bortoli @ 2018-10-27 19:58 UTC (permalink / raw)
  To: vyasevich, nhorman, marcelo.leitner
  Cc: davem, linux-sctp, netdev, linux-kernel, syzkaller, Tomas Bortoli

It is possible to perform out-of-bound reads on
sctp_getsockopt_pr_streamstatus() and on
sctp_getsockopt_pr_assocstatus() by passing from userspace a
sprstat_policy that overflows the abandoned_sent/abandoned_unsent
fixed length arrays. The over-read data are directly copied/leaked
to userspace.

Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+5da0d0a72a9e7d791748@syzkaller.appspotmail.com
---
 net/sctp/socket.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index fc0386e8ff23..5290b8bd40c8 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -7083,7 +7083,8 @@ static int sctp_getsockopt_pr_assocstatus(struct sock *sk, int len,
 	}
 
 	policy = params.sprstat_policy;
-	if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL)))
+	if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
+	    __SCTP_PR_INDEX(policy) > SCTP_PR_INDEX(MAX))
 		goto out;
 
 	asoc = sctp_id2assoc(sk, params.sprstat_assoc_id);
@@ -7142,7 +7143,8 @@ static int sctp_getsockopt_pr_streamstatus(struct sock *sk, int len,
 	}
 
 	policy = params.sprstat_policy;
-	if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL)))
+	if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL)) ||
+	    __SCTP_PR_INDEX(policy) > SCTP_PR_INDEX(MAX))
 		goto out;
 
 	asoc = sctp_id2assoc(sk, params.sprstat_assoc_id);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-10-28  0:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-27 19:58 [PATCH] sctp: socket.c validate sprstat_policy Tomas Bortoli
2018-10-27 19:58 ` Tomas Bortoli
2018-10-27 20:20 ` Tomas Bortoli
2018-10-27 20:20   ` Tomas Bortoli
2018-10-27 20:43   ` Tomas Bortoli
2018-10-27 20:43     ` Tomas Bortoli
2018-10-28  0:03     ` David Miller
2018-10-28  0:03       ` David Miller
2018-10-27 20:50 ` kbuild test robot
2018-10-27 20:50   ` kbuild test robot
2018-10-27 20:53 ` kbuild test robot
2018-10-27 20:53   ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.