[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190530.123305.679690617064301115.davem@davemloft.net>
Date: Thu, 30 May 2019 12:33:05 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: 92siuyang@...il.com
Cc: edumazet@...gle.com, kuznet@....inr.ac.ru, yoshfuji@...ux-ipv6.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ipv4: tcp_input: fix stack out of bounds when parsing
TCP options.
From: Young Xiao <92siuyang@...il.com>
Date: Wed, 29 May 2019 16:10:59 +0800
> The TCP option parsing routines in tcp_parse_options function could
> read one byte out of the buffer of the TCP options.
>
> 1 while (length > 0) {
> 2 int opcode = *ptr++;
> 3 int opsize;
> 4
> 5 switch (opcode) {
> 6 case TCPOPT_EOL:
> 7 return;
> 8 case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */
> 9 length--;
> 10 continue;
> 11 default:
> 12 opsize = *ptr++; //out of bound access
>
> If length = 1, then there is an access in line2.
> And another access is occurred in line 12.
> This would lead to out-of-bound access.
>
> Therefore, in the patch we check that the available data length is
> larger enough to pase both TCP option code and size.
>
> Signed-off-by: Young Xiao <92siuyang@...il.com>
Applied.
Powered by blists - more mailing lists