From owner-doc-jp@jp.freebsd.org  Thu Nov  2 09:57:36 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id JAA12085;
	Thu, 2 Nov 2000 09:57:36 +0900 (JST)
	(envelope-from owner-doc-jp@jp.FreeBSD.org)
Received: from eos.ocn.ne.jp (eos.ocn.ne.jp [210.190.142.171])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id JAA12080
	for <doc-jp@jp.freebsd.org>; Thu, 2 Nov 2000 09:57:35 +0900 (JST)
	(envelope-from hrs@eos.ocn.ne.jp)
Received: from mail.hrslab.yi.org (p0189-ip01funabasi.chiba.ocn.ne.jp [211.123.225.189])
	by eos.ocn.ne.jp (8.9.1a/OCN/) with ESMTP id JAA04432
	for <doc-jp@jp.freebsd.org>; Thu, 2 Nov 2000 09:58:41 +0900 (JST)
Message-Id: <200011020058.JAA04432@eos.ocn.ne.jp>
Received: from localhost (alph.hrslab.yi.org [192.168.0.10])
	by mail.hrslab.yi.org (8.9.3/3.7W/DomainMaster) with ESMTP id JAA94926
	for <doc-jp@jp.freebsd.org>; Thu, 2 Nov 2000 09:57:10 +0900 (JST)
	(envelope-from hrs@eos.ocn.ne.jp)
To: doc-jp@jp.freebsd.org
In-Reply-To: <20001101225954.E5B2C37B479@hub.freebsd.org>
References: <20001101225954.E5B2C37B479@hub.freebsd.org>
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Thu_Nov__2_09:56:57_2000_809)--"
Content-Transfer-Encoding: 7bit
Date: Thu, 02 Nov 2000 09:57:08 +0900
From: Hiroki Sato <hrs@eos.ocn.ne.jp>
X-Dispatcher: imput version 20000228(IM140)
Lines: 207
Reply-To: doc-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: doc-jp 7787
Subject: [doc-jp 7787] Re: FreeBSD Security Advisory: FreeBSD-SA-00:62.top
Errors-To: owner-doc-jp@jp.freebsd.org
Sender: owner-doc-jp@jp.freebsd.org
X-Originator: hrs@eos.ocn.ne.jp

----Next_Part(Thu_Nov__2_09:56:57_2000_809)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

$B:4F#!wEl5~M}2JBg3X$G$9!#(B

 00:62 $B$NK]Lu$G$9!#(B


----Next_Part(Thu_Nov__2_09:56:57_2000_809)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Disposition: attachment; filename="00:62"
Content-Transfer-Encoding: 7bit

 $B$3$N%a!<%k$O(B, announce-jp $B$KN.$l$?(B

  Subject: FreeBSD Security Advisory: FreeBSD-SA-00:62.top
  From: FreeBSD Security Advisories <security-advisories@freebsd.org>
  Date: Wed,  1 Nov 2000 14:59:54 -0800 (PST)
  Message-Id: <20001101225954.E5B2C37B479@hub.freebsd.org>
  X-Sequence: 

 $B$rF|K\8lLu$7$?$b$N$G$9(B. 

 $B$3$N4+9p$NCf$G>R2p$5$l$F$$$k(B WWW $B%5%$%H(B http://www.FreeBSD.org/ $B$*$h$S(B
 FTP $B%5%$%H(B ftp://ftp.FreeBSD.org/ $B$K$O(B, $BF|K\$N%_%i!<%5%$%H$,B8:_$7$^$9(B.
 $B%_%i!<%5%$%H$rMxMQ$9$k$K$O(B,
 http://www.FreeBSD.org/ $B$r(B http://www.jp.FreeBSD.org/www.freebsd.org/ $B$K(B,
 ftp://ftp.FreeBSD.org/ $B$r(B ftp://ftp.jp.FreeBSD.org/ $B$K(B,
 $B$=$l$>$lCV$-49$($F$/$@$5$$(B.

 $B%M%C%H%o!<%/$N:.;($r4KOB$9$k$?$a(B, $B$^$:$O%_%i!<%5%$%H$NMxMQ$r(B
 $B9MN8$9$k$h$&$*4j$$$7$^$9(B.  $B%_%i!<%5%$%H$K4X$9$k>\:Y$O(B

  http://www.FreeBSD.org/handbook/mirror.html ($B1QJ8(B)
  http://www.FreeBSD.org/ja/handbook/mirror.html ($BF|K\8lLu(B)

 $B$K(B, $B$^$?(B, $B2a5n$NF|K\8lHG%;%-%e%j%F%#4+9p$O(B

  http://www.FreeBSD.org/ja/security/

 $B$K$^$H$a$i$l$F$$$^$9(B.

 $B86J8$O(B PGP $B=pL>$5$l$F$$$^$9$,(B, $B$3$NF|K\8lLu$O(B PGP $B=pL>$5$l$F$$$^$;$s(B. 
 $B%Q%C%AEy$NFbMF$,2~cb$5$l$F$$$J$$$3$H$r3NG'$9$k$?$a$K(B PGP $B$N%A%'%C%/$r(B
 $B9T$J$&$K$O(B, $B86J8$r;2>H$7$F$/$@$5$$(B. 

 $BF|K\8lLu$O(B FreeBSD $BF|K\8l%I%-%e%a%s%F!<%7%g%s%W%m%8%'%/%H(B (doc-jp) $B$,;29M$N(B
 $B$?$a$KDs6!$9$k$b$N$G(B, doc-jp $B$O(B $B$=$NFbMF$K$D$$$F$$$+$J$kJ]>Z$b$$$?$7$^$;$s(B.
 $BF|K\8lLu$K$D$$$F$N$*Ld$$9g$o$;$O(B doc-jp@jp.FreeBSD.org $B$^$G$*4j$$$7$^$9(B.

--($B$3$3$+$i(B)
=============================================================================
FreeBSD-SA-00:62                                           Security Advisory
                                                                FreeBSD, Inc.

$B%H%T%C%/(B:	top allows reading of kernel memory

$BJ,N`(B:		core
$B%b%8%e!<%k(B:	top
$B9pCNF|(B:		2000-11-01
$B%/%l%8%C%H(B:	vort@wiretapped.net $B$,(B OpenBSD $B$GH/8+(B
$B1F6AHO0O(B:	FreeBSD 3.x ($B$9$Y$F$N%j%j!<%9(B),
                FreeBSD 4.x (4.2 $B$h$jA0$N$9$Y$F$N%j%j!<%9(B),
                $B=$@5F|0JA0$N(B FreeBSD 3.5.1-STABLE $B$*$h$S(B 4.1.1-STABLE
$B=$@5F|(B:		2000/10/04 (FreeBSD 4.1.1-STABLE)
                2000/10/04 (FreeBSD 3.5.1-STABLE)
FreeBSD $B$K8GM-$+(B:	NO

I.   $BGX7J(B - Background

top is a utility for displaying current system resource statistics
such as process CPU and memory use.  It is externally-maintained,
contributed software which is included in FreeBSD by default.

top $B$O(B CPU $B$d%a%b%j$N;HMQ>u67$H$$$C$?!"8=:_$N%7%9%F%`%j%=!<%9$NE}7W>pJs$r(B
$BI=<($9$k%f!<%F%#%j%F%#$G$9(B.  top $B$OFbIt$GJ]<i$5$l$F$$$k$b$N$G$O$J$/(B,
$B30It$+$i4sB#$5$l(B, FreeBSD $B$KI8=`$GAH$_9~$^$l$F$$$k%=%U%H%&%'%"$G$9(B.

II.  $BLdBj$N>\:Y(B - Problem Description

A "format string vulnerability" was discovered in the top(1) utility
which allows unprivileged local users to cause the top process to
execute arbitrary code.  The top utility runs with increased
privileges as a member of the kmem group, which allows it to read from
kernel memory (but not write to it).  A process with the ability to
read from kernel memory can monitor privileged data such as network
traffic, disk buffers and terminal activity, and may be able to
leverage this to obtain further privileges on the local system or on
other systems, including root privileges.

top(1) $B$K$O(B, $B9b$$8"8B$r;}$?$J$$%m!<%+%k%f!<%6$,(B top $B%W%m%;%9$r(B
$BMxMQ$7$FG$0U$N%3!<%I$r<B9T$G$-$k$h$&$J(B, $B!V=q<0;XDjJ8;zNs$K5/0x$9$k(B
$B%;%-%e%j%F%#>e$N<eE@!W$,H/8+$5$l$F$$$^$9(B.  top $B%f!<%F%#%j%F%#$O(B
$B%+!<%M%k%a%b%j$rFI$_=P$9$3$H$,2DG=(B ($B$?$@$7=q$-9~$_$OIT2D(B) $B$J(B
kmem $B%0%k!<%W$N8"8B$G<B9T$5$l$^$9(B.  $B%+!<%M%k%a%b%j$rFI$`$3$H$N(B
$B$G$-$k%W%m%;%9$O(B, $B$?$H$($P%M%C%H%o!<%/%H%i%U%#%C%/(B, $B%G%#%9%/%P%C%U%!(B,
$BC<Kv$NI=<(>uBV$H$$$C$?%"%/%;%9$K9b$$8"8B$rI,MW$H$9$k%G!<%?$r(B
$B%b%K%?%j%s%0$9$k$3$H$,$G$-$k$?$a(B, $B%m!<%+%k%7%9%F%`(B, $B$"$k$$$OB>$N(B
$B%7%9%F%`$K$*$$$F(B, $B$=$N>pJs$,(B root $B8"8B$r4^$`(B, $B$5$i$K9b$$8"8B$r(B
$BF@$k$?$a$KMxMQ$5$l$k4m81@-$,$"$j$^$9(B.

All released versions of FreeBSD prior to the correction date
including 4.0, 4.1, 4.1.1 and 3.5.1 are vulnerable to this problem,
but it was fixed in the 4.1.1-STABLE branch prior to the release of
FreeBSD 4.2-RELEASE.

FreeBSD 4.0, 4.1, 4.1.1 $B$*$h$S(B 3.5.1 $B$r4^$`(B, $B=$@5F|0JA0$N$9$Y$F$N(B
FreeBSD $B%j%j!<%9$,$3$NLdBj$N1F6A$r<u$1$^$9(B.
$BLdBjE@$N=$@5$O(B FreeBSD 4.2-RELEASE $B$N8x3+A0$N(B 4.1.1-STABLE $B%V%i%s%A$G(B
$B9T$J$o$l$^$7$?(B.


III. $B1F6AHO0O(B - Impact

Local users can read privileged data from kernel memory which may
provide information allowing them to further increase their local or
remote system access privileges.

$B%m!<%+%k%f!<%6$O(B, $B%+!<%M%k%a%b%j$+$i%"%/%;%9$K9b$$8"8B$rI,MW$H$9$k%G!<%?$r(B
$BFI$_=P$9$3$H$,2DG=$G$9(B.  $B%+!<%M%k%a%b%j$+$iFI$_=P$;$k%G!<%?$K$O(B,
$B%m!<%+%k$b$7$/$O%j%b!<%H%7%9%F%`$K$*$$$F(B, $B9b$$%"%/%;%98"8B$rF@$k$?$a$K(B
$BMxMQ$G$-$k$h$&$J>pJs$r4^$s$G$$$k2DG=@-$,$"$j$^$9(B.

IV.  $B2sHrJ}K!(B - Workaround

Remove the setgid bit on the top utilities.  This has the side-effect
that users who are not a member of the kmem group or who are not the
superuser cannot use the top utility.

top $B%f!<%F%#%j%F%#$+$i(B setgid $B%S%C%H$r:o=|$7$F$/$@$5$$(B.  $B$3$l$K$h$j(B,
$B%9!<%Q%f!<%6$H(B kmem $B%0%k!<%W$KB0$7$F$$$k%f!<%60J30$N%f!<%6$O(B
top $B%f!<%F%#%j%F%#$rMxMQ$G$-$J$/$J$k$H$$$&I{:nMQ$,$"$j$^$9(B.

# chmod g-s /usr/bin/top

V.   $B2r7h:v(B - Solution

One of the following:
$B<!$N$$$:$l$+$K=>$C$F$/$@$5$$(B.

1) Upgrade your vulnerable FreeBSD system to 4.1.1-STABLE or
3.5.1-STABLE after the respective correction dates.
1) $B<eE@$r;}$C$?(B FreeBSD $B%7%9%F%`$r(B, $B=$@5F|0J9_$N(B
   4.1.1-STABLE $B$b$7$/$O(B 3.5.1-STABLE $B$K%"%C%W%0%l!<%I$7$^$9(B.

2) Apply the patch below and recompile the relevant files:
2) $B2<$N=$@5%Q%C%A$rE,MQ$7(B, $B4XO"%U%!%$%k$r:F9=C[$7$F$/$@$5$$(B.

Either save this advisory to a file, or download the patch and
detached PGP signature from the following locations, and verify the
signature using your PGP utility.
$B$3$N4+9p$r%U%!%$%k$KJ]B8$9$k$+(B, $B=$@5%Q%C%A$H(B PGP $B=pL>$r0J2<$N>l=j$+$i(B
$B%@%&%s%m!<%I$7(B, PGP $B%f!<%F%#%j%F%#$r;H$C$F=pL>$r3NG'$7$^$9(B.

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

Execute the following commands as root:
root $B8"8B$G<!$N%3%^%s%I$r<B9T$7$^$9(B.

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

Patch for vulnerable systems:
$B<eE@$r;}$C$?%7%9%F%`MQ$N=$@5%Q%C%A(B:

    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;
     				    }

$hrs: FreeBSD-SA/00:62,v 1.1 2000/11/02 00:55:21 hrs Exp $

----Next_Part(Thu_Nov__2_09:56:57_2000_809)----
