Security-Announce archive

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

NetBSD Security Advisory 2017-005: x86: vulnerabilities in context handling



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

		NetBSD Security Advisory 2017-005
		=================================

Topic:		x86: vulnerabilities in context handling


Version:	NetBSD-current:		source prior to Sun, Jul 1st 2017
		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:	Privilege escalation / Local DoS

Fixed:		NetBSD-current:		Sun, Jul 1st 2017
		NetBSD-7-1 branch:	Thu, Jul 20th 2017
		NetBSD-7-0 branch:	Thu, Jul 20th 2017
		NetBSD-7 branch:	Thu, Jul 20th 2017
		NetBSD-6-1 branch:	Tue, Aug 8th 2017
		NetBSD-6-0 branch:	Tue, Aug 8th 2017
		NetBSD-6 branch:	Tue, Aug 8th 2017

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
========

Three issues were discovered in the i386 and amd64 ports of NetBSD:

 1) A missing check in the trap handler could allow userland to panic an i386
    kernel.
 2) A race condition could allow userland to panic an i386 kernel, and
    escalate privileges on amd64.
 3) A missing check in the Linux compatibility layer could allow userland to
    exploit the Intel Sysret Vulnerability on amd64.


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

 1) Under certain circumstances, userland can legitimately make the kernel
    generate a stack fault when executing 'iret'. However, in the trap handler,
    the appropriate check was missing, and this fault could lead to a panic.
 2) The same call gate existed on i386 and amd64 that allowed binaries from
    previous releases to perform syscalls. However, call gates do not
    automatically disable interrupts when entering the target function.
    Therefore, there was a condition where the kernel would be executed with
    userland registers loaded and interrupts enabled, which breaks a certain
    number of assumptions in the i386 and amd64 implementations. On i386 this
    can lead to a panic, and on amd64 to a privilege escalation.
 3) A missing check in the trap frame could allow userland to have the kernel
    execute 'sysret' with a fully-controllable %rip, thereby allowing the
    exploitation of the Intel Sysret Vulnerability (see NetBSD-SA2012-003).


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 summarise 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
 ----     ----     --------     ----------     ----------
 sys/arch/i386/i386/trap.c
          1.288    1.272.4.2    1.272.6.2      1.272.10.2
 sys/arch/i386/i386/locore.S
          1.146    1.112.4.1    1.112.6.1      1.112.10.1
 sys/arch/i386/i386/machdep.c
          1.783    1.752.4.1    1.752.8.1      1.752.12.1
 sys/arch/amd64/amd64/trap.c
          1.96     1.78.4.3     1.78.6.3       1.78.10.3
 sys/arch/amd64/amd64/locore.S
          1.124    1.76.2.2     1.76.4.2       1.76.8.2
 sys/arch/amd64/amd64/machdep.c
          1.254    1.211.2.1    1.211.6.1      1.211.10.1
 sys/compat/linux/arch/amd64/linux_machdep.c
          1.51     1.48.4.1     1.48.8.1       1.48.4.1

 FILE              netbsd-6     netbsd-6-0     netbsd-6-1
 ----              --------     ----------     ----------
 sys/arch/i386/i386/trap.c
                   1.262.8.2    1.262.12.2     1.262.14.2
 sys/arch/i386/i386/locore.S
                   1.95.10.4    1.95.10.2.4.1  1.95.10.3.2.1
 sys/arch/i386/i386/machdep.c
                   1.717.2.8    1.717.2.7.4.1  1.717.2.7.6.1
 sys/arch/amd64/amd64/trap.c
                   1.69.2.3     1.69.2.1.4.2   1.69.2.1.6.2
 sys/arch/amd64/amd64/locore.S
                   1.66.2.2     1.66.2.1.4.1   1.66.2.1.6.1
 sys/arch/amd64/amd64/machdep.c
                   1.175.2.9    1.175.2.7.2.2  1.175.2.8.2.1
 sys/compat/linux/arch/amd64/linux_machdep.c
                   1.39.6.1     1.39.10.1      1.39.12.1

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

	# cd src
	# cvs update -d -P -r VERSION sys/arch/i386/i386/trap.c
	# cvs update -d -P -r VERSION sys/arch/i386/i386/locore.S
	# cvs update -d -P -r VERSION sys/arch/i386/i386/machdep.c
	# cvs update -d -P -r VERSION sys/arch/amd64/amd64/trap.c
	# cvs update -d -P -r VERSION sys/arch/amd64/amd64/locore.S
	# cvs update -d -P -r VERSION sys/arch/amd64/amd64/machdep.c
	# cvs update -d -P -r VERSION sys/compat/linux/arch/amd64/linux_machdep.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 issues, Chuck Silvers for proposing
a better fix for issue 2).


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

	2017-09-08	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-SA2017-00X.txt.asc

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


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

iQIcBAEBAgAGBQJZsqiyAAoJEAZJc6xMSnBuCOwQAMKKCxNKpCLLfgA8LZZTxQz5
WnzV6J3iAa7G7LPPgkGIHi87o0pgMhQf3YpWwrhI1sevHvX+bAk13HZSTNeLENnE
a08hZALZbk9BzVZK3tzSYNJMjZcXGmk1R9du5OV4H53ApGQrpDn6K/RdVp5YdJps
iPk20i9lUZC00SYEO96/nVuLU0FcC4wQrdXa7iK4pi62KhYhmSwVTk6NIBA0NWta
rW/emzUAspriW8l13WTRYOew0R5W2EMOvpJZoaCHaPW/MKDeQK0N8YSlRXiBJQuT
ehb9+7Z01RbAWxt8a7Xv/kZVe/ibttKgAa2LJ/rrG5Og0Jg2m+eCEq66m3gMyAbR
+OzGmWk598hJ//SeykHYtV/7zfMznI/JLMldxD4X2zp5nC5kalIfkSNVXi50dsDv
UhizH1GVw2ZMzlAKRu7QqeuhFNF4PmOi+3DW1FkDckcf/FOIgfafmh6TqSSayQYS
vyUmGiUPL71+bcVzKttYz/P3NsFvjge9rFS881+//F73IEiZkPIts/Gus9cgORST
DaRe2mpGpHtnvVjCaEnj2JnDfA6wn2LqqYjv9eZ/sx7cEdVq5+lYFsE1ioP3WdCA
MKtGTxalKeFP4lF7LVMlbgH9bX2mS2CvJAkGSyfeHmZ+tDP8mpUXHAa038Mmpf3R
iBZDxJx7PCwzYGLRMMDl
=Ew1W
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index