Home    |    View Topics    |    Search    |    Contact Us    |   



Category:   OS (UNIX)  >   NetBSD Vendors:   NetBSD
NetBSD x86 Context Handling Errors Let Local Users Deny Service and Gain Elevated Privileges
SecurityTracker Alert ID:  1039312
SecurityTracker URL:
CVE Reference:   GENERIC-MAP-NOMATCH   (Links to External Site)
Date:  Sep 11 2017
Impact:   Denial of service via local system, Execution of arbitrary code via local system, Root access via local system
Fix Available:  Yes  Vendor Confirmed:  Yes  
Version(s): 6.0 - 6.0.5, 6.1 - 6.1.4, 7.0 - 7.0.2, 7.1
Description:   A vulnerability was reported in NetBSD. A local user can cause the target system to crash. A local user can obtain elevated privileges on the target system.

A local user can exploit an error in the trap handler to cause a kernel panic on i386 systems.

A local user can exploit a race condition to cause a kernel panic on i386 systems and to gain elevated privileges on amd64 systems.

A local user can exploit an error in the Linux compatibility layer to execute 'sysret' with a user-specified %rip register value to execute arbitrary code with kernel level privileges on amd64 systems.

Maxime Villard reported this vulnerability.

Impact:   A local user can cause the target system to crash.

A local user can obtain elevated privileges on the target system.

Solution:   The vendor has issued a fix.

The vendor advisory is available at:

Vendor URL: (Links to External Site)
Cause:   Access control error, State error

Message History:   None.

 Source Message Contents

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

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.


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
 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
 ----     ----     --------     ----------     ----------
          1.783    1.752.4.1    1.752.8.1      1.752.12.1

 FILE              netbsd-6     netbsd-6-0     netbsd-6-1
 ----              --------     ----------     ----------
                   1.717.2.8    1.717.  1.717.

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
	# ./ 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:

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

Information about NetBSD and NetBSD security can be found at and .

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


Go to the Top of This SecurityTracker Archive Page

Home   |    View Topics   |    Search   |    Contact Us

This web site uses cookies for web analytics. Learn More

Copyright 2021, LLC