From owner-doc-jp-work@jp.FreeBSD.org Sat Jan 11 16:42:18 2003
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) id h0B7gI323997;
	Sat, 11 Jan 2003 16:42:18 +0900 (JST)
	(envelope-from owner-doc-jp-work@jp.FreeBSD.org)
Received: from smtp.eos.ocn.ne.jp (eos.ocn.ne.jp [211.6.83.117])
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) with ESMTP/inet id h0B7gIJ23992
	for <doc-jp-work@jp.FreeBSD.org>; Sat, 11 Jan 2003 16:42:18 +0900 (JST)
	(envelope-from hrs@eos.ocn.ne.jp)
Received: from mail.allbsd.org (p44077-adsao12honb4-acca.tokyo.ocn.ne.jp [219.114.51.77])
	by smtp.eos.ocn.ne.jp (Postfix) with ESMTP id 230A83A7B
	for <doc-jp-work@jp.FreeBSD.org>; Sat, 11 Jan 2003 16:42:18 +0900 (JST)
Received: from localhost (alph.allbsd.org [192.168.0.10])
	by mail.allbsd.org (8.12.3/3.7W/DomainMaster) with ESMTP id h0B7ffB2044381
	for <doc-jp-work@jp.FreeBSD.org>; Sat, 11 Jan 2003 16:41:41 +0900 (JST)
	(envelope-from hrs@eos.ocn.ne.jp)
Message-Id: <20030111.163742.26455339.hrs@eos.ocn.ne.jp>
To: doc-jp-work@jp.FreeBSD.org
From: Hiroki Sato <hrs@eos.ocn.ne.jp>
In-Reply-To: <20030109.124856.115493440.y-koga@jp.FreeBSD.org>
	<20030108.103133.104034783.hino@ccrl.sj.nec.com>
References: <200301071749.h07Hn85x058198@freefall.freebsd.org>
	<20030109.012510.76994119.hrs@eos.ocn.ne.jp>
	<20030109.124856.115493440.y-koga@jp.FreeBSD.org>
X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530  FFD7 4F2C D3D8 2793 CF2D
X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.0 (HANANOEN)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Sat_Jan_11_16:37:42_2003_582)--"
Content-Transfer-Encoding: 7bit
Reply-To: doc-jp-work@jp.FreeBSD.org
Precedence: list
Date: Sat, 11 Jan 2003 16:37:42 +0900
X-Sequence: doc-jp-work 579
Subject: [doc-jp-work 579] Re: ANNOUNCE: FreeBSD Security Advisory
 FreeBSD-SA-02:44.filedesc
Errors-To: owner-doc-jp-work@jp.FreeBSD.org
Sender: owner-doc-jp-work@jp.FreeBSD.org
X-Originator: hrs@eos.ocn.ne.jp
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+030107

----Next_Part(Sat_Jan_11_16:37:42_2003_582)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

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

Koji Hino <hino@ccrl.sj.nec.com> wrote
  in <20030108.103133.104034783.hino@ccrl.sj.nec.com>:

hino> fpathconf $B%7%9%F%`%3!<%k$O!"%Q%9L>$d%U%!%$%k5-=R;R$KBP1~$9$k!"@_Dj2DG=(B
hino> $B$J%7%9%F%`@)8BCM$d%*%W%7%g%sJQ?t$N8=:_$NCM$r!"%"%W%j%1!<%7%g%s$+$i;2>H(B
hino> $B$G$-$k$h$&$K$9$k$?$a$N$b$N$G$9!#(B
hino> 
hino> $B$G$O$$$+$,!)(B

Koga Youichirou <y-koga@jp.FreeBSD.org> wrote
  in <20030109.124856.115493440.y-koga@jp.FreeBSD.org>:

y-koga> $B86J8$O%^%K%e%"%k$+$i0z$CD%$C$F$$$k$+$i$3$&$J$C$F$$$^$9$,!"(Bfpathconf
y-koga> $B$O%Q%9L>$r$H$j$^$;$s!#%Q%9L>$r$H$k$N$O(B pathconf() $B$G$9!#(B

 s/$BJQ99(B/$B@_Dj(B/;s/$B%Q%9L>$d(B// $B$K$7$F!"=g=x$rF~$l49$($^$7$?!#(B
 configurable $B$OE}0l$7$F$$$^$;$s!#(Btunable $B$H$+$H4^$a$FE}0l$7$?J}$,(B
 $B$$$$$+$b$7$l$J$$$G$9$M(B...

Koji Hino <hino@ccrl.sj.nec.com> wrote
  in <20030108.103133.104034783.hino@ccrl.sj.nec.com>:

hino> $B!V7e$"$U$l!W$N$[$&$,NI$$$h$&$J!#(B
(snip)
hino> if$B$O(Band$B$N8e$m$^$G$+$+$C$F$$$k$h$&$K;W$$$^$9!#$h$C$F!"(B

 $B=$@5$7$^$7$?!#(B
 
Koga Youichirou <y-koga@jp.FreeBSD.org> wrote
  in <20030109.124856.115493440.y-koga@jp.FreeBSD.org>:

y-koga> > There is no workaround.
y-koga> > $B2sHrJ}K!$OH=L@$7$F$$$^$;$s!#(B
y-koga> 
y-koga> $B!V$"$j$^$;$s!W$@$H;W$$$^$9!#(B

 $B$&!#$3$l$O(B cut & paste $B%_%9$G$9!#=$@5$7$^$7$?!#(B


 $B=$@5HG$N:9J,$HA4J8$rE:IU$7$F$*$-$^$9!#LdBj$,$J$$$h$&$G$7$?$i(B
 01/11 $B$NLk$KN.$9$D$b$j$G$9!#(B

--
| $B:4F#(B $B9-@8!wEl5~M}2JBg3X(B <hrs@eos.ocn.ne.jp>
|                         <hrs@FreeBSD.org> (FreeBSD Project)

----Next_Part(Sat_Jan_11_16:37:42_2003_582)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="02:44.diff"

Index: 02:44
===================================================================
RCS file: /home/cvs/private/hrs/announce-jp/FreeBSD-SA/02:44,v
retrieving revision 1.3
diff -d -u -I\$FreeBSD:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -r1.3 02:44
--- 02:44	8 Jan 2003 16:25:00 -0000	1.3
+++ 02:44	11 Jan 2003 07:20:50 -0000
@@ -62,9 +62,9 @@
 determine the current value of a configurable system limit or option
 variable associated with a pathname or file descriptor.
 
-fpathconf $B%7%9%F%`%3!<%k$O!"JQ992DG=$J%7%9%F%`@)8BCM$d(B
-$B%*%W%7%g%sJQ?t$N8=:_$NCM$r!"%"%W%j%1!<%7%g%s$+$i%Q%9L>$d(B
-$B%U%!%$%k5-=R;R$r;H$C$F;2>H$G$-$k$h$&$K$9$k$?$a$N$b$N$G$9!#(B
+fpathconf $B%7%9%F%`%3!<%k$O!"@_Dj2DG=$J%7%9%F%`@)8BCM$d(B
+$B%*%W%7%g%sJQ?t$N8=:_$NCM$r!"%U%!%$%k5-=R;R$r;XDj$9$k$3$H$G(B
+$B%"%W%j%1!<%7%g%s$+$i;2>H$G$-$k$h$&$K$9$k$?$a$N$b$N$G$9!#(B
 
 
 II.  $BLdBj$N>\:Y(B - Problem Description
@@ -89,7 +89,7 @@
 to a negative value, and then calling close on that file descriptor.
 
 $B%m!<%+%k$N967b<T$O!"0l$D$N%U%!%$%k5-=R;R$KBP$7$F7+$jJV$7(B fpatchconf $B$r(B 
-$B8F$S=P$7$F;2>H%+%&%s%H$rIi$NCM$K%i%C%W%"%i%&%s%I$5$;!"$=$N8e$K(B
+$B8F$S=P$7$F;2>H%+%&%s%H$r7e$"$U$l$5$;$k$3$H$GIi$NCM$K$7!"$=$N8e$K(B
 $B$=$N%U%!%$%k5-=R;R$KBP$7$F(B close $B$r8F$S=P$9$H$$$&A`:n$r9T$J$&$3$H$G!"(B
 $B%*%Z%l!<%F%#%s%0%7%9%F%`$r%/%i%C%7%e$5$;$k$3$H$,$G$-$k2DG=@-$,$"$j$^$9!#(B
 
@@ -100,9 +100,9 @@
 access to that file.  This may in turn lead to privilege escalation.
 
 $B$^$?!"$3$l$OL$3d$jEv$F$N%+!<%M%k%a%b%j$r;2>H$9$kM-8z$J%U%!%$%k5-=R;R$r(B
-$B$D$/$j$@$92DG=@-$,$"$j$^$9!#$=$N$h$&$J5-=R;R$r:n@.$7$?8e$K(B
-$B?7$7$$%U%!%$%k$r(B open $B$9$k$H!"%+!<%M%k$OF1$8%a%b%j0LCV$K(B
-$B?7$7$$%U%!%$%k9=B$BN$r3d$jEv$F$k$?$a!"967b<T$O$=$N%U%!%$%k$K(B
+$B$D$/$j$@$92DG=@-$,$"$j$^$9!#$=$N$h$&$J5-=R;R$r:n@.$7$?8e$K%+!<%M%k$,(B
+$B?7$7$$%U%!%$%k$r(B open $B$7!"F1$8%a%b%j0LCV$K?7$7$$%U%!%$%k9=B$BN$r(B
+$B3d$jEv$F$F$7$^$C$?>l9g!"967b<T$O$=$N%U%!%$%k$K(B
 $BBP$7$FFI$_=q$-%"%/%;%9$,$G$-$k2DG=@-$,$"$j$^$9!#(B
 $B$3$l$O9b$$8"8B$rIT@5$K3MF@$9$k$?$a$N>pJs8;$K$J$k$+$bCN$l$^$;$s!#(B
 
@@ -110,7 +110,7 @@
 IV.  $B2sHrJ}K!(B - Workaround
 
 There is no workaround.
-$B2sHrJ}K!$OH=L@$7$F$$$^$;$s!#(B
+$B2sHrJ}K!$O$"$j$^$;$s!#(B
 
 
 V.   $B2r7h:v(B - Solution

----Next_Part(Sat_Jan_11_16:37:42_2003_582)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="02:44"

FreeBSD $B%;%-%e%j%F%#4+9p(B $BF|K\8lHG(B
=============================================================================
FreeBSD-SA-02:44.filedesc (2003-01-07)
 * file descriptor leak in fpathconf
=============================================================================

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

  Subject: ANNOUNCE: FreeBSD Security Advisory FreeBSD-SA-02:44.filedesc
  From: FreeBSD Security Advisories <security-advisories@FreeBSD.org>
  Date: Tue, 7 Jan 2003 09:49:08 -0800
  Message-Id: <200301071749.h07Hn85x058198@freefall.freebsd.org>
  X-Sequence: announce-jp 1087

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

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

 $BF|K\8lLu$*$h$S%_%i!<%5%$%HMxMQ$N>\:Y$K$D$$$F$O!"J8Kv$N!V(BA. FreeBSD
 $B%;%-%e%j%F%#4+9p(B $BF|K\8lHG$K$D$$$F!W$r$4Mw$/$@$5$$!#(B


                                     [$BK]Lu<T(B: $B:4F#(B $B9-@8(B <hrs@jp.FreeBSD.org>]
--($B$3$3$+$i(B)

=============================================================================
FreeBSD-SA-02:44.filedesc                                   Security Advisory
                                                          The FreeBSD Project

$B%H%T%C%/(B:	fpathconf $B$K$*$1$k%U%!%$%k5-=R;R$N%j!<%/LdBj(B
                (file descriptor leak in fpathconf)

$BJ,N`(B:		core
$B%b%8%e!<%k(B:	kernel
$B9pCNF|(B:		2003-01-07
$B%/%l%8%C%H(B:	Joost Pol <joost@pine.nl>
$B1F6AHO0O(B:	FreeBSD 4.3-RELEASE $B$*$h$S!"$=$l0J9_$N%P!<%8%g%s(B
$B=$@5F|(B:		2002-11-11 01:43:31 UTC (RELENG_4)
                2003-01-06 12:37:52 UTC (RELENG_4_7)
                2003-01-06 12:38:21 UTC (RELENG_4_6)
                2003-01-07 15:17:16 UTC (RELENG_4_5)
                2003-01-07 15:17:40 UTC (RELENG_4_4)
                2003-01-06 21:20:54 UTC (RELENG_5_0)
FreeBSD $B$K8GM-$+(B:	YES


0.   $B2~D{MzNr(B - Revision History

2003-01-06  v1.0  Initial release.
2003-01-06  v1.0  $B=iHG8x3+(B
2003-01-07  v1.1  Added information regarding bug in FreeBSD 5.x.
                  Added correction details for RELENG_4_5, RELENG_4_4.
2003-01-07  v1.1  FreeBSD 5.x $B$N%P%0$K4X$9$k>pJs$rDI2C!#(B
                  RELENG_4_5, RELENG_4_4 $B%V%i%s%A$N=$@5J}K!$N>\:Y$rDI2C!#(B


I.   $BGX7J(B - Background

The fpathconf system call provides a method for applications to
determine the current value of a configurable system limit or option
variable associated with a pathname or file descriptor.

fpathconf $B%7%9%F%`%3!<%k$O!"@_Dj2DG=$J%7%9%F%`@)8BCM$d(B
$B%*%W%7%g%sJQ?t$N8=:_$NCM$r!"%U%!%$%k5-=R;R$r;XDj$9$k$3$H$G(B
$B%"%W%j%1!<%7%g%s$+$i;2>H$G$-$k$h$&$K$9$k$?$a$N$b$N$G$9!#(B


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

A programming error in the fpathconf system call can result in the
given file descriptor's reference count being erroneously incremented.

fpathconf $B$K$O!";XDj$5$l$?%U%!%$%k5-=R;R$N;2>H%+%&%s%H$,IT@5$K(B
$B%$%s%/%j%a%s%H$5$l$k2DG=@-$N$"$k!"%W%m%0%i%`>e$N8m$j$,4^$^$l$F$$$^$9!#(B

A similar problem exists in the developer preview versions of FreeBSD
5.0, affecting the lseek(2), dup(2), and other system calls.

$BF1MM$NLdBj$O(B FreeBSD 5.0 $B%G%Y%m%C%Q%W%l%S%e!<HG$K$bB8:_$7$^$9!#(B
$B1F6A$9$k%7%9%F%`%3!<%k$K$O!"(Blseek(2), dup(2) $B$J$I$,4^$^$l$^$9!#(B


III. $B1F6AHO0O(B - Impact

A local attacker may cause the operating system to crash by repeatedly
calling fpathconf on a file descriptor until the reference count wraps
to a negative value, and then calling close on that file descriptor.

$B%m!<%+%k$N967b<T$O!"0l$D$N%U%!%$%k5-=R;R$KBP$7$F7+$jJV$7(B fpatchconf $B$r(B 
$B8F$S=P$7$F;2>H%+%&%s%H$r7e$"$U$l$5$;$k$3$H$GIi$NCM$K$7!"$=$N8e$K(B
$B$=$N%U%!%$%k5-=R;R$KBP$7$F(B close $B$r8F$S=P$9$H$$$&A`:n$r9T$J$&$3$H$G!"(B
$B%*%Z%l!<%F%#%s%0%7%9%F%`$r%/%i%C%7%e$5$;$k$3$H$,$G$-$k2DG=@-$,$"$j$^$9!#(B

Similarly, it may be possible to cause a file descriptor to reference
unallocated kernel memory, but remain valid.  If a new file is later
opened and the kernel allocates the new file structure at the same
memory location, then an attacker may be able to gain read or write
access to that file.  This may in turn lead to privilege escalation.

$B$^$?!"$3$l$OL$3d$jEv$F$N%+!<%M%k%a%b%j$r;2>H$9$kM-8z$J%U%!%$%k5-=R;R$r(B
$B$D$/$j$@$92DG=@-$,$"$j$^$9!#$=$N$h$&$J5-=R;R$r:n@.$7$?8e$K%+!<%M%k$,(B
$B?7$7$$%U%!%$%k$r(B open $B$7!"F1$8%a%b%j0LCV$K?7$7$$%U%!%$%k9=B$BN$r(B
$B3d$jEv$F$F$7$^$C$?>l9g!"967b<T$O$=$N%U%!%$%k$K(B
$BBP$7$FFI$_=q$-%"%/%;%9$,$G$-$k2DG=@-$,$"$j$^$9!#(B
$B$3$l$O9b$$8"8B$rIT@5$K3MF@$9$k$?$a$N>pJs8;$K$J$k$+$bCN$l$^$;$s!#(B


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

There is no workaround.
$B2sHrJ}K!$O$"$j$^$;$s!#(B


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

The following patch has been verified to apply to FreeBSD 4.4, 4.5,
4.6, and 4.7 systems.
$B0J2<$N=$@5%Q%C%A$O!"(BFreeBSD 4.4$B!"(BFreeBSD 4.5$B!"(BFreeBSD 4.6$B!"(B
FreeBSD 4.7 $B$N3F%7%9%F%`$KE,MQ2DG=$J$3$H$,3NG'$5$l$F$$$k$b$N$G$9!#(B

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.
a) $B0J2<$N>l=j$+$i=$@5%Q%C%A$r%@%&%s%m!<%I$7!"(BPGP $B%f!<%F%#%j%F%#$r;H$C$F(B
   PGP $B=pL>$r3NG'$7$^$9!#(B

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:44/filedesc.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:44/filedesc.patch.asc

b) Apply the patch.
b) $B=$@5%Q%C%A$rE,MQ$7$^$9!#(B

# cd /usr/src
# patch < /path/to/patch

 ($BLuCm(B: /path/to/patch $B$NItJ,$O=$@5%Q%C%A$N%Q%9L>$KCV$-49$($F$/$@$5$$(B)

c) Recompile your kernel as described in
<URL:http://www.freebsd.org/handbook/kernelconfig.html> and reboot the
system.
c) <URL:http://www.freebsd.org/handbook/kernelconfig.html> $B$K=q$+$l$F$$$k(B
   $B<j=g$K$7$?$,$C$F%+!<%M%k$r:F9=C[$7!"%7%9%F%`$r:F5/F0$7$^$9!#(B


VI.  $B=$@5$N>\:Y(B - Correction details

The following list contains the revision numbers of each file that was
corrected in FreeBSD.

FreeBSD $B$K$*$$$F:#2s=$@5$5$l$?3F%U%!%$%k$N%j%S%8%g%sHV9f$O!"0J2<$N$H$*$j$G$9!#(B

Path                                                             Revision
  Branch
$B%Q%9L>(B                                                          $B%j%S%8%g%s(B
  $B%V%i%s%A(B
- -------------------------------------------------------------------------
src/sys/kern/kern_descrip.c
  RELENG_4                                                      1.81.2.15
  RELENG_4_7                                                1.81.2.14.4.1
  RELENG_4_6                                                1.81.2.14.2.1
  RELENG_4_5                                                 1.81.2.9.2.3
  RELENG_4_4                                                 1.81.2.8.2.3
  RELENG_5_0                                                    1.169.2.2
src/sys/kern/vfs_syscalls.c
  RELENG_5_0                                                    1.297.2.2
- -------------------------------------------------------------------------


VII. $B;29M;qNA(B - References

<URL:http://www.pine.nl/press/pine-cert-20030101.txt>


A.   FreeBSD $B%;%-%e%j%F%#4+9p(B $BF|K\8lHG$K$D$$$F(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$,(B
$B;29M$N$?$a$KDs6!$9$k$b$N$G$9!#2a5n$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

$B$?$@$7K]Lu<T$*$h$S(B doc-jp $B$O!"$=$NFbMF$K$D$$$F$$$+$J$kJ]>Z$b(B
$B$$$?$7$^$;$s$N$G$4Cm0U$/$@$5$$!#F|K\8lLu$K$D$$$F$N$40U8+!"$4MWK>!"(B
$B$*Ld$$9g$o$;Ey$O(B doc-jp@jp.FreeBSD.org $B$^$G$*4j$$$7$^$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%M%C%H%o!<%/$N:.;($r4KOB$9$k$?$a!"$^$:$O%_%i!<%5%$%H$NMxMQ$r(B
$B9MN8$9$k$h$&$*4j$$$7$^$9!#(B

$BF|K\$N%_%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

$BB>$NCO0h$r4^$`%_%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$^$H$a$i$l$F$$$^$9!#(B

$hrs: announce-jp/FreeBSD-SA/02:44,v 1.3 2003/01/08 16:25:00 hrs Exp $

----Next_Part(Sat_Jan_11_16:37:42_2003_582)----
