ESB-2018.0441 - [NetBSD] kernel: Denial of service - Remote/unauthenticated 2018-02-14

Printable version
PGP/GPG verifiable version

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

===========================================================================
             AUSCERT External Security Bulletin Redistribution

                               ESB-2018.0441
                     Remote Memory Corruption in IPv6
                             14 February 2018

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:           kernel
Publisher:         NetBSD
Operating System:  NetBSD
Impact/Access:     Denial of Service -- Remote/Unauthenticated
Resolution:        Patch/Upgrade

Original Bulletin: 
   http://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2018-004.txt.asc

Comment: The advisory acknowledges the possibility of a code execution attack.

- --------------------------BEGIN INCLUDED TEXT--------------------

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


		NetBSD Security Advisory 2018-004
		=================================

Topic:		Remote Memory Corruption in IPv6

Version:	NetBSD-current:		source prior to Tue, Jan 30th 2018
		NetBSD 7.1:		affected
		NetBSD 7.0 - 7.0.2:	affected
		NetBSD 6.1 - 6.1.4:	affected
		NetBSD 6.0 - 6.0.5:	affected

Severity:	Remote DoS, Remote Memory Corruption

Fixed:		NetBSD-current:		Tue, Jan 30th 2018
		NetBSD-7-1 branch:	Tue, Jan 30th 2018
		NetBSD-7-0 branch:	Tue, Jan 30th 2018
		NetBSD-7 branch:	Tue, Jan 30th 2018
		NetBSD-6-1 branch:	Tue, Jan 30th 2018
		NetBSD-6-0 branch:	Tue, Jan 30th 2018
		NetBSD-6 branch:	Tue, Jan 30th 2018

Teeny versions released later than the fix date will contain the fix.

Please note that NetBSD releases prior to 6.0 are no longer supported.
It is recommended that all users upgrade to a supported release.


Abstract
========

A mistake in the way received IPv6 packets are handled allowed an attacker
to remotely trigger a memory corruption.


Technical Details
=================

When a packet is received, the kernel stores it in memory as chain of mbufs.
An mbuf is basically a block of contiguous memory.

A function, located deep into the IPv6 entry point, was not performing the
necessary checks when treating a received IPv6 packet. It was parsing the
IPv6 options assuming they were located in the first mbuf of the chain, but
this assumption was incorrect. Therefore, it was possible for this function
to return a pointer that pointed to an area located after the first mbuf.

This pointer was then either read from, or written to with one byte that
could be controlled by the packet.

It has been demonstrated that by sending a special combination of nested
IPv6 fragments, this bug could be exploited remotely, and could allow an
attacker to cause the kernel to behave unexpectedly because random areas of
memory were overwritten. It is not clear whether this attack could be turned
to a code execution attack.

The PF firewall can mitigate this particular attack, because it rejects
nested IPv6 fragments by default. NPF does not reject such fragments by
default. The status of IPF in this regard has not been investigated. It is
possible that other vectors than IPv6 fragments could trigger this
vulnerability.


Solutions and Workarounds
=========================

For all NetBSD versions, you need to obtain fixed kernel sources,
rebuild and install the new kernel, and reboot the system.

The fixed source may be obtained from the NetBSD CVS repository.
The following instructions briefly summarize how to upgrade your
kernel. In these instructions, replace:

  ARCH     with your architecture (from uname -m),
  KERNCONF with the name of your kernel configuration file and
  VERSION  with the file version below

File versions containing the fixes:

 FILE     HEAD     netbsd-7     netbsd-7-0     netbsd-7-1
 ----     ----     --------     ----------     ----------
 src/sys/netinet6/frag6.c
          1.65     1.55.4.1     1.55.6.1       1.55.10.1
 src/sys/netinet6/ip6_input.c
          1.187    1.149.2.2    1.149.2.1.2.1  1.149.2.1.6.1
 src/sys/netinet6/ip6_var.h
          1.78     1.62.2.2     1.62.2.1.2.1   1.62.2.1.6.1
 src/sys/netinet6/raw_ip6.c
          1.160    1.136.2.2    1.136.6.1      1.136.2.1.2.1


 FILE              netbsd-6     netbsd-6-0     netbsd-6-1
 ----              --------     ----------     ----------
 src/sys/netinet6/frag6.c
                   1.52.2.3     1.52.2.1.4.2   1.52.2.2.2.1
 src/sys/netinet6/ip6_input.c
                   1.136.2.2    1.136.6.2      1.136.8.2
 src/sys/netinet6/ip6_var.h
                   1.58.2.2     1.58.6.2       1.58.8.2
 src/sys/netinet6/raw_ip6.c
                   1.109.2.1    1.109.6.1      1.109.8.1
 src/sys/netinet6/ah_input.c
                   1.59.8.1     1.59.12.1      1.59.14.1
 src/sys/netinet6/esp_input.c
                   1.50.8.1     1.50.12.1      1.50.14.1
 src/sys/netinet6/ipcomp_input.c
                   1.38.8.1     1.38.12.1      1.38.14.1

Note: for NetBSD-6, there are three more files that contain the fix.


To update from CVS, re-build, and re-install the kernel:

	# cd src
	# cvs update -d -P -r VERSION sys/netinet6/frag6.c
	# cvs update -d -P -r VERSION sys/netinet6/ip6_input.c
	# cvs update -d -P -r VERSION sys/netinet6/ip6_var.h
	# cvs update -d -P -r VERSION sys/netinet6/raw_ip6.c

If you run NetBSD-6:
	# cvs update -d -P -r VERSION sys/netinet6/ah_input.c
	# cvs update -d -P -r VERSION sys/netinet6/esp_input.c
	# cvs update -d -P -r VERSION sys/netinet6/ipcomp_input.c

	# ./build.sh kernel=KERNCONF
	# mv /netbsd /netbsd.old
	# cp sys/arch/ARCH/compile/obj/KERNCONF/netbsd /netbsd
	# shutdown -r now

For more information on how to do this, see:

   http://www.NetBSD.org/guide/en/chap-kernel.html


Thanks To
=========

Maxime Villard for finding and fixing the issue.


Revision History
================

	2018-02-12	Initial release


More Information
================

Advisories may be updated as new information becomes available.
The most recent version of this advisory (PGP signed) can be found at
  http://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2018-0XX.txt.asc

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.org/ and http://www.NetBSD.org/Security/ .


Copyright 2018, The NetBSD Foundation, Inc.  All Rights Reserved.
Redistribution permitted only in full, unmodified form.
- -----BEGIN PGP SIGNATURE-----

iQIcBAEBAgAGBQJage/nAAoJEAZJc6xMSnBuCSAQAI+h5bvTOzT8Ezn6NCNR6k+8
w93BPxBFCFluJuKDY4e33Ndt04gZYz7FXPAKti8XWLJ3316pi2bXwO0BwGUwI1V9
b9TWWlwPka9cVDaKm3A6GZK4iR8KuKVOWK8Q+V+fF/iRpoohtGrpse9jhtZk0yVA
nRsc7QfPr134eVqwE0nZu9waWgRYPBAPcARIG/aby8oXpQt/gnj66IKqXKPaJaLZ
A0l77Rybns03ihNzaOKOwA5iVgoXHt0G9iN4HDosEpsefHTxq7kv3TfqY7I6uAqK
4KZ0OjEnhlokUvn3CF+tx+1tSkwFgr35zjKxutqgbWZXQRMvvmk0b7PWeVoAhwjU
uS6ArCZgvwk7/OVkNHqDxz+qAjo8zmfCC1ZBq6ZdYn8LoYnbpO5RUF7vSlci7zAe
RqPHJ6k4YvzE/+Z+z4bc5zTtOIrlzQXWoHhzua3E8EvvAp81N8s9I7j5Li+sFrLx
06vbHrSN0o4dYlHxbwOJ9xUVggubnGMlay3ArDTGtfihTkAlMsjs/AGZHHIprIl3
MZhm5WX0gj2PLhtd2ByL6nls05v3o0rFSVDHTet/ff+pcvf3zb0wmoWsjvmHbaCx
FPqb9DbQ2Za38zSUDZy1gppa3S3EIKV9aYnUbhWmoxMr+5pD5FTwsmdVu/YraU5J
LWEtvindpvyNBjz+/izI
=QoMB
- -----END PGP SIGNATURE-----

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        https://www.auscert.org.au/bulletins/

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQIVAwUBWoPFh4x+lLeg9Ub1AQjwog//ZyFdugFK1oSrgwLeXMjTp2l0U2Cd3uJy
OjSzRxISb0Fb/Z3fXMvMzNlvQHBDMmLeAmeq6G1cs4QynWg6veXTM3JYIjTaoTW7
iVEPQ6tyFNQmNk424DgYbpdRxY+YLzlghpRItNWIu0zZwveSHuR6PJRDWSzulzcR
GFrUMtrsTOgg3A8easzwFdZqwf8C5PC86cTcEyefjhbBCeRi8e9vDGv2tPcAAMZg
fMfDb7t7hAuDoxN2o6921/vuE+U1nFb4VBKjy9FwhGor0dSaqgse5hWgQHBlCalg
umZDITWl3e6nQTNQP3SO+943H2NEpwe9HW+VPEPDIcDh4T9Ec1QwnUPcOIJ2elnN
uNurCfjQrL/6QQn3Np7xbwgQmMFXGT3UJdg4CGFHn8g9nLnskttxkXIavf+woKlj
0exefM8ZO0TmVXWzmCbemNmcXEgENsniXBa++3r3S59SO2Dog6EQUsWsyHA7dQAg
8tYJFfkA2Eo/2a3kZv9UAIwaBlL/XzFdngfucS6HZnOH/jTXqTiOWtVflGkvi1lD
dZqdSBKjGVwtkXVCIAJQriBRMM/kPmKyDVT1wwmMHSTWr+eYK/CLjtlwaqdLIwII
AP1X0sIg7dYCZymvgJFD2XqrivU9YvFlrQMzbJjBQ4OXPOekXdUZ2CUYaTSi6hii
7yxfxn8ha+0=
=Zjap
-----END PGP SIGNATURE-----

« Back to bulletins