Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1625401 > unrolled thread

Re: net/ipv6: slab-out-of-bounds read in seg6_validate_srh

Started byDavid Lebrun <david.lebrun@uclouvain.be>
First post2017-04-18 17:30 +0200
Last post2017-04-18 17:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: net/ipv6: slab-out-of-bounds read in seg6_validate_srh David Lebrun <david.lebrun@uclouvain.be> - 2017-04-18 17:30 +0200
    Re: net/ipv6: slab-out-of-bounds read in seg6_validate_srh Andrey Konovalov <andreyknvl@google.com> - 2017-04-18 17:50 +0200

#1625401 — Re: net/ipv6: slab-out-of-bounds read in seg6_validate_srh

FromDavid Lebrun <david.lebrun@uclouvain.be>
Date2017-04-18 17:30 +0200
SubjectRe: net/ipv6: slab-out-of-bounds read in seg6_validate_srh
Message-ID<txDeN-7Mn-17@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On 04/18/2017 04:54 PM, Andrey Konovalov wrote:
> Hi,
> 
> I've got the following error report while fuzzing the kernel with syzkaller.
> 
> On commit 4f7d029b9bf009fbee76bb10c0c4351a1870d2f3 (4.11-rc7).
> 
> A reproducer and .config are attached.
> 
> ==================================================================
> BUG: KASAN: slab-out-of-bounds in seg6_validate_srh+0x203/0x220
> net/ipv6/seg6.c:57 at addr ffff88006a759608
> Read of size 1 by task syz-executor4/2627

Thanks for the report. It seems to happen when the trailing data is less
than sizeof(struct sr6_tlv). The following (untested) patch should fix
the issue, I'll test it and submit it properly if it works.

diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
index a855eb3..5f44ffe 100644
--- a/net/ipv6/seg6.c
+++ b/net/ipv6/seg6.c
@@ -53,6 +53,9 @@ bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len)
 		struct sr6_tlv *tlv;	
 		unsigned int tlv_len;

+		if (trailing < sizeof(*tlv))
+			return false;
+
 		tlv = (struct sr6_tlv *)((unsigned char *)srh + tlv_offset);
 		tlv_len = sizeof(*tlv) + tlv->len;



[toc] | [next] | [standalone]


#1625409

FromAndrey Konovalov <andreyknvl@google.com>
Date2017-04-18 17:50 +0200
Message-ID<txDya-7Sz-9@gated-at.bofh.it>
In reply to#1625401
On Tue, Apr 18, 2017 at 5:16 PM, David Lebrun <david.lebrun@uclouvain.be> wrote:
> On 04/18/2017 04:54 PM, Andrey Konovalov wrote:
>> Hi,
>>
>> I've got the following error report while fuzzing the kernel with syzkaller.
>>
>> On commit 4f7d029b9bf009fbee76bb10c0c4351a1870d2f3 (4.11-rc7).
>>
>> A reproducer and .config are attached.
>>
>> ==================================================================
>> BUG: KASAN: slab-out-of-bounds in seg6_validate_srh+0x203/0x220
>> net/ipv6/seg6.c:57 at addr ffff88006a759608
>> Read of size 1 by task syz-executor4/2627
>
> Thanks for the report. It seems to happen when the trailing data is less
> than sizeof(struct sr6_tlv). The following (untested) patch should fix
> the issue, I'll test it and submit it properly if it works.

Hi David,

This fixes the bug.

Thanks!

Tested-by: Andrey Konovalov <andreyknvl@google.com>

>
> diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
> index a855eb3..5f44ffe 100644
> --- a/net/ipv6/seg6.c
> +++ b/net/ipv6/seg6.c
> @@ -53,6 +53,9 @@ bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len)
>                 struct sr6_tlv *tlv;
>                 unsigned int tlv_len;
>
> +               if (trailing < sizeof(*tlv))
> +                       return false;
> +
>                 tlv = (struct sr6_tlv *)((unsigned char *)srh + tlv_offset);
>                 tlv_len = sizeof(*tlv) + tlv->len;
>
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web