HomeFreeBSD

Adopt revision 1.76 and 1.77 from NetBSD:

Description

Adopt revision 1.76 and 1.77 from NetBSD:

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.

Reported by: Maxime Villard <maxv at NetBSD.org>
MFC after: 1 week

Details

Provenance
aeAuthored on
Parents
rS328351: malloc(9): Change nominal size to size_t to match standard C
Branches
Unknown
Tags
Unknown