GLSA 200401-01: Linux kernel do_mremap() local privilege escalation vulnerability

Severity:high
Title:Linux kernel do_mremap() local privilege escalation vulnerability
Date:01/08/2004
Bugs: #37292
ID:200401-01

Synopsis

A critical security vulnerability has been found in recent Linux kernels which allows for local privelege escalation.

Background

The Linux kernel is responsible for memory management in a working system - to allow this, processes are allowed to allocate and unallocate memory.

Affected packages

Package Vulnerable Unaffected Architecture(s)
sys-kernel/aa-sources < 2.4.23-r1 >= 2.4.23-r1 All supported architectures
sys-kernel/alpha-sources < 2.4.21-r2 >= 2.4.21-r2 All supported architectures
sys-kernel/arm-sources < 2.4.19-r2 >= 2.4.19-r2 All supported architectures
sys-kernel/ck-sources < 2.4.23-r1 >= 2.4.23-r1 All supported architectures
sys-kernel/compaq-sources < 2.4.9.32.7-r1 >= 2.4.9.32.7-r1 All supported architectures
sys-kernel/development-sources < 2.6.1_rc3 >= 2.6.1_rc3 All supported architectures
sys-kernel/gaming-sources < 2.4.20-r7 >= 2.4.20-r7 All supported architectures
sys-kernel/gentoo-dev-sources < 2.6.1_rc3 >= 2.6.1_rc3 All supported architectures
sys-kernel/gentoo-sources < 2.4.22-r3 > 2.4.22-r3 All supported architectures
sys-kernel/grsec-sources < 2.4.23.2.0_rc4-r1 > 2.4.23.2.0_rc4-r1 All supported architectures
sys-kernel/gs-sources < 2.4.23_pre8-r2 >= 2.4.23_pre8-r2 All supported architectures
sys-kernel/hardened-sources < 2.4.22-r2 >= 2.4.22-r2 All supported architectures
sys-kernel/hppa-sources < 2.4.23_p4-r2 >= 2.4.23_p4-r2 All supported architectures
sys-kernel/ia64-sources < 2.4.22-r2 >= 2.4.22-r2 All supported architectures
sys-kernel/mips-prepatch-sources < 2.4.24_pre2-r1 >= 2.4.24_pre2-r1 All supported architectures
sys-kernel/mips-sources < 2.4.23-r2 >= 2.4.23-r2 All supported architectures
sys-kernel/mm-sources < 2.6.1_rc1-r2 >= 2.6.1_rc1-r2 All supported architectures
sys-kernel/openmosix-sources < 2.4.22-r3 >= 2.4.22-r3 All supported architectures
sys-kernel/pac-sources < 2.4.23-r1 >= 2.4.23-r1 All supported architectures
sys-kernel/pfeifer-sources < 2.4.21.1_pre4-r1 >= 2.4.21.1_pre4-r1 All supported architectures
sys-kernel/planet-ccrma-sources < 2.4.21-r4 >= 2.4.21-r4 All supported architectures
sys-kernel/ppc-development-sources < 2.6.1_rc1-r1 >= 2.6.1_rc1-r1 All supported architectures
sys-kernel/ppc-sources < 2.4.23-r1 >= 2.4.23-r1 All supported architectures
sys-kernel/ppc-sources-benh < 2.4.22-r4 >= 2.4.22-r4 All supported architectures
sys-kernel/ppc-sources-crypto < 2.4.20-r2 >= 2.4.20-r2 All supported architectures
sys-kernel/selinux-sources < 2.4.24 >= 2.4.24 All supported architectures
sys-kernel/sparc-dev-sources < 2.6.1_rc2 >= 2.6.1_rc2 All supported architectures
sys-kernel/sparc-sources < 2.4.24 >= 2.4.24 All supported architectures
sys-kernel/usermode-sources < 2.4.23-r1 >= 2.4.23-r1 All supported architectures
sys-kernel/vanilla-prepatch-sources < 2.4.25_pre4 >= 2.4.25_pre4 All supported architectures
sys-kernel/vanilla-sources < 2.4.24 >= 2.4.24 All supported architectures
sys-kernel/win4lin-sources < 2.6.0-r1 >= 2.6.0-r1 All supported architectures
sys-kernel/wolk-sources < 4.10_pre7-r2 >= 4.10_pre7-r2 All supported architectures
sys-kernel/xfs-sources < 2.4.23-r1 >= 2.4.23-r1 All supported architectures

Description

The memory subsystem allows for shrinking, growing, and moving of chunks of memory along any of the allocated memory areas which the kernel posesses.

A typical virtual memory area covers at least one memory page. An incorrect bound check discovered inside the do_mremap() kernel code performing remapping of a virtual memory area may lead to creation of a virtual memory area of 0 bytes length.

The problem is based on the general mremap flaw that remapping 2 pages from inside a VMA creates a memory hole of only one page in length but an additional VMA of two pages. In the case of a zero sized remapping request no VMA hole is created but an additional VMA descriptor of 0 bytes in length is created.

This advisory also addresses an information leak in the Linux RTC system.

Impact

Arbitrary code may be able to exploit this vulnerability and may disrupt the operation of other parts of the kernel memory management subroutines finally leading to unexpected behavior.

Since no special privileges are required to use the mremap(2) system call any process may misuse its unexpected behavior to disrupt the kernel memory management subsystem. Proper exploitation of this vulnerability may lead to local privilege escalation including execution of arbitrary code with kernel level access.

Proof-of-concept exploit code has been created and successfully tested, permitting root escalation on vulnerable systems. As a result, all users should upgrade their kernels to new or patched versions.

Workaround

There is no temporary workaround - a kernel upgrade is required. A list of unaffected kernels is provided along with this announcement.

Resolution

Users are encouraged to upgrade to the latest available sources for their system:

    $> emerge sync
    $> emerge -pv your-favourite-sources
    $> emerge your-favourite-sources
    $> # Follow usual procedure for compiling and installing a kernel.
    $> # If you use genkernel, run genkernel as you would do normally.

    $> # IF YOUR KERNEL IS MARKED as "remerge required!" THEN
    $> # YOU SHOULD UPDATE YOUR KERNEL EVEN IF PORTAGE
    $> # REPORTS THAT THE SAME VERSION IS INSTALLED.

References

Availability

This GLSA and any updates to it are available for viewing at the Gentoo Security Website: http://security.gentoo.org/glsa/glsa-200401-01.xml

Concerns?

Security is a primary focus of Gentoo Linux and ensuring the confidentiality and security of our users machines is of utmost importance to us. Any security concerns should be addressed to security@gentoo.org or alternatively, you may file a bug at https://bugs.gentoo.org.

License

Copyright 2010 Gentoo Foundation, Inc; referenced text belongs to its owner(s). The contents of this document are licensed under the Creative Commons - Attribution / Share Alike license.

Thank you!