GLSA-200403-02 : Linux kernel do_mremap local privilege escalation vulnerability

high Nessus Plugin ID 14453

Synopsis

The remote Gentoo host is missing one or more security-related patches.

Description

The remote host is affected by the vulnerability described in GLSA-200403-02 (Linux kernel do_mremap local privilege escalation vulnerability)

The memory subsystem allows for shrinking, growing, and moving of chunks of memory along any of the allocated memory areas which the kernel possesses.
To accomplish this, the do_mremap code calls the do_munmap() kernel function to remove any old memory mappings in the new location - but, the code doesn't check the return value of the do_munmap() function which may fail if the maximum number of available virtual memory area descriptors has been exceeded.
Due to the missing return value check after trying to unmap the middle of the first memory area, the corresponding page table entries from the second new area are inserted into the page table locations described by the first old one, thus they are subject to page protection flags of the first area. As a result, arbitrary code can be executed.
Impact :

Arbitrary code with normal non-super-user privileges 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() and munmap() system calls any process may misuse this unexpected behavior to disrupt the kernel memory management subsystem. Proper exploitation of this vulnerability may lead to local privilege escalation allowing for the execution of arbitrary code with kernel level root 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 :

Users who are unable to upgrade their kernels may attempt to use 'sysctl -w vm.max_map_count=1000000', however, this is a temporary fix which only solves the problem by increasing the number of memory areas that can be created by each process. Because of the static nature of this workaround, it is not recommended and users are urged to upgrade their systems to the latest available patched sources.

Solution

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.

See Also

https://isec.pl/en/vulnerabilities/isec-0014-mremap-unmap.txt

https://security.gentoo.org/glsa/200403-02

Plugin Details

Severity: High

ID: 14453

File Name: gentoo_GLSA-200403-02.nasl

Version: 1.21

Type: local

Published: 8/30/2004

Updated: 1/6/2021

Supported Sensors: Nessus

Risk Information

VPR

Risk Factor: High

Score: 8.9

CVSS v2

Risk Factor: High

Base Score: 7.2

Vector: CVSS2#AV:L/AC:L/Au:N/C:C/I:C/A:C

Vulnerability Information

CPE: p-cpe:/a:gentoo:linux:aa-sources, p-cpe:/a:gentoo:linux:alpha-sources, p-cpe:/a:gentoo:linux:ck-sources, p-cpe:/a:gentoo:linux:compaq-sources, p-cpe:/a:gentoo:linux:development-sources, p-cpe:/a:gentoo:linux:gaming-sources, p-cpe:/a:gentoo:linux:gentoo-dev-sources, p-cpe:/a:gentoo:linux:gentoo-sources, p-cpe:/a:gentoo:linux:grsec-sources, p-cpe:/a:gentoo:linux:gs-sources, p-cpe:/a:gentoo:linux:hardened-sources, p-cpe:/a:gentoo:linux:hppa-dev-sources, p-cpe:/a:gentoo:linux:hppa-sources, p-cpe:/a:gentoo:linux:ia64-sources, p-cpe:/a:gentoo:linux:mips-prepatch-sources, p-cpe:/a:gentoo:linux:mips-sources, p-cpe:/a:gentoo:linux:mm-sources, p-cpe:/a:gentoo:linux:openmosix-sources, p-cpe:/a:gentoo:linux:pac-sources, p-cpe:/a:gentoo:linux:planet-ccrma-sources, p-cpe:/a:gentoo:linux:ppc-development-sources, p-cpe:/a:gentoo:linux:ppc-sources, p-cpe:/a:gentoo:linux:ppc-sources-benh, p-cpe:/a:gentoo:linux:ppc-sources-crypto, p-cpe:/a:gentoo:linux:ppc-sources-dev, p-cpe:/a:gentoo:linux:selinux-sources, p-cpe:/a:gentoo:linux:sparc-dev-sources, p-cpe:/a:gentoo:linux:sparc-sources, p-cpe:/a:gentoo:linux:usermode-sources, p-cpe:/a:gentoo:linux:vanilla-prepatch-sources, p-cpe:/a:gentoo:linux:vanilla-sources, p-cpe:/a:gentoo:linux:win4lin-sources, p-cpe:/a:gentoo:linux:wolk-sources, p-cpe:/a:gentoo:linux:xfs-sources, cpe:/o:gentoo:linux

Required KB Items: Host/local_checks_enabled, Host/Gentoo/release, Host/Gentoo/qpkg-list

Exploit Available: true

Exploit Ease: Exploits are available

Patch Publication Date: 3/5/2004

Reference Information

CVE: CVE-2004-0077

GLSA: 200403-02