NetBSD x86 Context Handling Errors Let Local Users Deny Service and Gain Elevated Privileges
SecurityTracker Alert ID: 1039312|
SecurityTracker URL: http://securitytracker.com/id/1039312
(Links to External Site)
Date: Sep 11 2017
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|
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.
A local user can cause the target system to crash.|
A local user can obtain elevated privileges on the target system.
The vendor has issued a fix.|
The vendor advisory is available at:
Vendor URL: ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2017-005.txt.asc (Links to External Site)
Access control error, State error|
Source Message Contents
Subject: NetBSD Security Advisory 2017-005: x86: vulnerabilities in context handling|
-----BEGIN PGP SIGNED MESSAGE-----
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.
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.288 1.272.4.2 1.272.6.2 1.272.10.2
1.146 18.104.22.168 22.214.171.124 126.96.36.199
1.783 1.752.4.1 1.752.8.1 1.752.12.1
1.96 188.8.131.52 184.108.40.206 220.127.116.11
1.124 18.104.22.168 22.214.171.124 126.96.36.199
1.254 188.8.131.52 184.108.40.206 220.127.116.11
1.51 18.104.22.168 22.214.171.124 126.96.36.199
FILE netbsd-6 netbsd-6-0 netbsd-6-1
---- -------- ---------- ----------
1.262.8.2 1.262.12.2 1.262.14.2
188.8.131.52 184.108.40.206.4.1 220.127.116.11.2.1
1.717.2.8 1.718.104.22.168.1 1.722.214.171.124.1
126.96.36.199 188.8.131.52.4.2 184.108.40.206.6.2
220.127.116.11 18.104.22.168.4.1 22.214.171.124.6.1
126.96.36.199 188.8.131.52.2.2 184.108.40.206.2.1
220.127.116.11 18.104.22.168 22.214.171.124
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:
Maxime Villard for finding and fixing the issues, Chuck Silvers for proposing
a better fix for issue 2).
2017-09-08 Initial release
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
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-----
-----END PGP SIGNATURE-----
Go to the Top of This SecurityTracker Archive Page