Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7-1]: src/sys/netipsec Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/c58b69839fd5
branches:  netbsd-7-1
changeset: 800838:c58b69839fd5
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jan 29 19:42:02 2018 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #1557):
        sys/netipsec/xform_ah.c: revision 1.76
Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely
crash the kernel with a single packet.
In this loop we need to increment 'ad' by two, because the length field
of the option header does not count the size of the option header itself.
If the length is zero, then 'count' is incremented by zero, and there's
an infinite loop. Beyond that, this code was written with the assumption
that since the IPv6 packet already went through the generic IPv6 option
parser, several fields are guaranteed to be valid; but this assumption
does not hold because of the missing '+2', and there's as a result a
triggerable buffer overflow (write zeros after the end of the mbuf,
potentially to the next mbuf in memory since it's a pool).
Add the missing '+2', this place will be reinforced in separate commits.

diffstat:

 sys/netipsec/xform_ah.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r f0d2fcc624fe -r c58b69839fd5 sys/netipsec/xform_ah.c
--- a/sys/netipsec/xform_ah.c   Mon Jan 22 20:03:06 2018 +0000
+++ b/sys/netipsec/xform_ah.c   Mon Jan 29 19:42:02 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ah.c,v 1.42 2013/11/03 18:37:10 mrg Exp $        */
+/*     $NetBSD: xform_ah.c,v 1.42.12.1 2018/01/29 19:42:02 martin Exp $        */
 /*     $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $   */
 /*     $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.42 2013/11/03 18:37:10 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.42.12.1 2018/01/29 19:42:02 martin Exp $");
 
 #include "opt_inet.h"
 #ifdef __FreeBSD__
@@ -527,12 +527,12 @@
                                                return EINVAL;
                                        }
 
-                                       ad = ptr[count + 1];
+                                       ad = ptr[count + 1] + 2;
 
                                        /* If mutable option, zeroize. */
                                        if (ptr[count] & IP6OPT_MUTABLE)
                                                memcpy(ptr + count, ipseczeroes,
-                                                   ptr[count + 1]);
+                                                   ad);
 
                                        count += ad;
 



Home | Main Index | Thread Index | Old Index