首页 -> 安全研究

安全研究

安全漏洞
FreeBSD-SA-00:62 top可能读取内核内存

发布日期:2000-11-02
更新日期:2000-11-08

受影响系统:

FreeBSD 3.x (所有版本),
FreeBSD 4.x (低于4.2的所有版本)
FreeBSD 3.5.1-STABLE (在更正日期之前的版本)
FreeBSD 4.1.1-STABLE (在更正日期之前的版本)
不受影响系统:

2000/10/04 (FreeBSD 4.1.1-STABLE)
2000/10/04 (FreeBSD 3.5.1-STABLE)
描述:

* FreeBSD重新更新了他们的安全公告,因为原来的补丁程序并没有完全解决所
* 有的问题。请用户尽快使用新的补丁程序进行升级。



top是一个用来显示当前系统资源(包括CPU处理器和内存使用)状况的工具。它
缺省随FreeBSD一起发布。

在top中存在一个格式串漏洞,允许未授权的本地用户利用top进程执行任意代码。
top运行时会以kmem组的身份运行,这允许top读取核心内存(但不能写入)。
如果一个进程可以从核心内存中读取信息,它就可以监视某些授权数据比如网
络流量,磁盘缓冲区以及终端活动。进一步的可能在本地系统或者其他系统中
获取更高权限,包括root权限。

所有在更正日期(2000/10/04)之前的FreeBSD(包括4.0, 4.1, 4.1.1 和3.5.1)
均受到影响。但是它已经在4.1.1-STABLE中被修复。


<* 来源: vort (vort@wiretapped.net)
          FreeBSD Security Advisory: FreeBSD-SA-00:62.top
*>


建议:

临时解决方法:

NSFOCUS建议您在没有升级程序之前按照FreeBSD安全公告中的方法去做:

删除top程序的seetgid位。这将是非kmem组或者非root用户不能使用top
程序。

# chmod g-s /usr/bin/top


厂商补丁:

您可以采用下列方法中的任意一种:

1) 将您的有问题的FreeBSD系统升级到更正日期后的4.1.1-STABLE或者3.5.1-
STABLE版本

2) 使用下面的补丁程序并且重建相关二进制程序

您可以保存这则公告到一个文件,或者从下列地址下载补丁以及PGP签名文件,并使用
您的PGP工具来验证签名。

ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:62/top.patch.v1.1
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:62/top.patch.v1.1.asc

然后以root身份这样操作:

# cd /usr/src/contrib/top
# patch -p < /path/to/patch_or_advisory
# cd /usr/src/usr.bin/top
# make depend && make all install

针对有问题系统的补丁如下:


    Index: display.c
    ===================================================================
    RCS file: /mnt/ncvs/src/contrib/top/display.c,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -r1.4 -r1.5
    --- display.c    1999/01/09 20:20:33    1.4
    +++ display.c    2000/10/04 23:34:16    1.5
    @@ -829,7 +831,7 @@
         register int i;

         /* first, format the message */
    -    (void) sprintf(next_msg, msgfmt, a1, a2, a3);
    +    (void) snprintf(next_msg, sizeof(next_msg), msgfmt, a1, a2, a3);

         if (msglen > 0)
         {
    Index: top.c
    ===================================================================
    RCS file: /mnt/ncvs/src/contrib/top/top.c,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -r1.4 -r1.5
    --- top.c    1999/01/09 20:20:34    1.4
    +++ top.c    2000/10/04 23:34:16    1.5
    @@ -807,7 +809,7 @@
                     {
                         if ((errmsg = kill_procs(tempbuf2)) != NULL)
                         {
    -                    new_message(MT_standout, errmsg);
    +                    new_message(MT_standout, "%s", errmsg);
                         putchar('\r');
                         no_command = Yes;
                         }
    Index: top.c
    ===================================================================
    RCS file: /mnt/ncvs/src/contrib/top/top.c,v
    retrieving revision 1.5
    retrieving revision 1.6
    diff -u -r1.5 -r1.6
    --- top.c    2000/10/04 23:34:16    1.5
    +++ top.c    2000/11/03 22:00:10    1.6
    @@ -826,7 +826,7 @@
                     {
                         if ((errmsg = renice_procs(tempbuf2)) != NULL)
                         {
    -                    new_message(MT_standout, errmsg);
    +                    new_message(MT_standout, "%s", errmsg);
                         putchar('\r');
                         no_command = Yes;
                         }


浏览次数:6148
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障