From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [193.142.43.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2558D72 for ; Thu, 10 Jun 2021 17:15:51 +0000 (UTC) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1lrNma-0002J9-Il; Thu, 10 Jun 2021 18:43:52 +0200 Date: Thu, 10 Jun 2021 18:43:52 +0200 From: Florian Westphal To: Maxim Mikityanskiy Cc: Mat Martineau , Matthieu Baerts , Jakub Kicinski , "David S. Miller" , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Toke =?iso-8859-15?Q?H=F8iland-J=F8rgensen?= , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Patrick McHardy , Jesper Dangaard Brouer , Paolo Abeni , Christoph Paasch , Peter Krystad , Young Xiao <92siuyang@gmail.com>, netdev@vger.kernel.org, mptcp@lists.linux.dev Subject: Re: [PATCH net v2 1/3] netfilter: synproxy: Fix out of bounds when parsing TCP options Message-ID: <20210610164352.GQ20020@breakpoint.cc> References: <20210610164031.3412479-1-maximmi@nvidia.com> <20210610164031.3412479-2-maximmi@nvidia.com> X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210610164031.3412479-2-maximmi@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Maxim Mikityanskiy wrote: > The TCP option parser in synproxy (synproxy_parse_options) could read > one byte out of bounds. When the length is 1, the execution flow gets > into the loop, reads one byte of the opcode, and if the opcode is > neither TCPOPT_EOL nor TCPOPT_NOP, it reads one more byte, which exceeds > the length of 1. > > This fix is inspired by commit 9609dad263f8 ("ipv4: tcp_input: fix stack > out of bounds when parsing TCP options."). Reviewed-by: Florian Westphal