From owner-doc-jp@jp.freebsd.org  Mon Nov 20 05:42:48 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id FAA77799;
	Mon, 20 Nov 2000 05:42:48 +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 FAA77794
	for <doc-jp@jp.freebsd.org>; Mon, 20 Nov 2000 05:42:48 +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 FAA03001
	for <doc-jp@jp.freebsd.org>; Mon, 20 Nov 2000 05:42:45 +0900 (JST)
Message-Id: <200011192042.FAA03001@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 FAA51734
	for <doc-jp@jp.freebsd.org>; Mon, 20 Nov 2000 05:41:54 +0900 (JST)
	(envelope-from hrs@eos.ocn.ne.jp)
To: doc-jp@jp.freebsd.org
In-Reply-To: <20001114223203.72E6B37B4D7@hub.freebsd.org>
References: <20001114223203.72E6B37B4D7@hub.freebsd.org>
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Mon_Nov_20_05:32:25_2000_41)--"
Content-Transfer-Encoding: 7bit
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Date: Mon, 20 Nov 2000 05:41:54 +0900
From: Hiroki Sato <hrs@eos.ocn.ne.jp>
X-Dispatcher: imput version 20000228(IM140)
Lines: 236
Reply-To: doc-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: doc-jp 7842
Subject: [doc-jp 7842] Re: ANNOUNCE: FreeBSD Security Advisory: FreeBSD-SA-00:70.ppp-nat
Errors-To: owner-doc-jp@jp.freebsd.org
Sender: owner-doc-jp@jp.freebsd.org
X-Originator: hrs@eos.ocn.ne.jp

----Next_Part(Mon_Nov_20_05:32:25_2000_41)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

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

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

 # $B;0$D$H$b2?$+$$$^$$$A$J$N$G(B
 # $BLu0FJg=8Cf(B :-) $B$G$9!#(B

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

----Next_Part(Mon_Nov_20_05:32:25_2000_41)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Disposition: attachment; filename="00:70"
Content-Transfer-Encoding: 7bit

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

  Subject: ANNOUNCE: FreeBSD Security Advisory: FreeBSD-SA-00:70.ppp-nat
  From: FreeBSD Security Advisories <security-advisories@freebsd.org>
  Date: Tue, 14 Nov 2000 14:32:03 -0800 (PST)
  Message-Id: <20001114223203.72E6B37B4D7@hub.freebsd.org>
  X-Sequence: announce-jp 602

 $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:70                                           Security Advisory
                                                                FreeBSD, Inc.

$B%H%T%C%/(B:	ppp "deny_incoming" does not correctly deny incoming packets

$BJ,N`(B:		core
$B%b%8%e!<%k(B:	ppp
$B9pCNF|(B:		2000-11-14
$B%/%l%8%C%H(B:	Robin Melville <robmel@innotts.co.uk>
$B1F6AHO0O(B:	FreeBSD 3.5, 3.5.1, 4.1, 4.1.1
                $B=$@5F|0JA0$N(B FreeBSD 3.5.1-STABLE $B$*$h$S(B 4.1.1-STABLE
$B=$@5F|(B:		2000-10-30 (FreeBSD 4.1.1-STABLE)
                2000-10-30 (FreeBSD 3.5.1-STABLE)
FreeBSD $B$K8GM-$+(B:	Yes

I.   $BGX7J(B - Background

The ppp(8) utility includes network address translation functionality
for translating between public and private IP address ranges.  It uses
the libalias library to perform translation services.

ppp(8) $B%f!<%F%#%j%F%#$K$O(B, $B8x3+%"%I%l%9$H%W%i%$%Y!<%H%"%I%l%9$rJQ49$9$k(B,
$B%M%C%H%o!<%/%"%I%l%9JQ495!G=(B ($BLuCm(B: $B$$$o$f$k(B NAT $B$N$3$H(B) $B$,4^$^$l$F$$$^$9(B.
$B$3$N5!G=$O(B, libalias $B%i%$%V%i%j$rMQ$$$F<B8=$5$l$F$$$^$9(B.

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

The "nat deny_incoming" command is documented as "refusing all
incoming connections" and is commonly used as a simple "firewall" to
prevent outside users from connecting to services on the internal
network.  However the behaviour of the ppp code was changed in the 4.x
and 3.x branches prior to the release of FreeBSD 4.1 and 3.5 (on
2000-06-05 and 2000-06-03 respectively) to allow passing of packets
which are not understood, such as IPSEC packets and other IP protocol
traffic not explicitly recognised by the code as being an "incoming
connection attempt".  While this was arguably incorrect behaviour in
itself, the code also incorrectly allowed through ALL incoming
traffic, effectively turning "deny_incoming" into a no-op.

ppp $B$N%I%-%e%a%s%H$K$h$k$H(B, "nat deny_incoming" $B%3%^%s%I$O(B
$B!VE~Ce$9$k$9$Y$F$N@\B3$r5qH]$9$k!W$H$J$C$F$$$^$9(B.  $B$3$l$O(B
$B30It$N%f!<%6$,FbIt%M%C%H%o!<%/$N%5!<%S%9$X@\B3$G$-$J$$$h$&$K$7(B,
ppp $B$r4J0WE*$J%U%!%$%"%&%)!<%k$H$7$FMxMQ$9$k$?$a$KNI$/;H$o$l$k(B
$B%3%^%s%I$G$9(B.  $B$7$+$7(B, 3.x $B%V%i%s%A$H(B 4.x $B%V%i%s%A$NN>J}$N(B ppp $B$N(B
$B%3!<%I$O(B FreeBSD 4.1 $B$*$h$S(B 3.5 $B$N%j%j!<%9A0(B (4.x $B$O(B 2000-06-05,
3.x $B$O(B 2000-06-03) $B$KF0:n$,JQ99$5$l(B, $BG'<1$G$-$J$$%Q%1%C%H(B, $B$?$H$($P(B
IPSEC $B%Q%1%C%H$dB>$N(B IP $B%W%m%H%3%k$N%Q%1%C%H$J$I(B, ppp $B$N=hM}%3!<%I$G(B
$B!VE~Ce$7$?@\B3MW5a!W$H$_$J$5$l$J$$%Q%1%C%H$K$D$$$F$O(B, $BDL2a$r5v2D$9$k(B
$B$h$&$K$J$j$^$7$?(B.  $B$3$l<+BN$b$*$=$i$/@5$7$$F0:n$H$O8@$($J$$$N$G$9$,(B,
ppp $B$N=hM}%3!<%I$O$5$i$K(B, $B8m$C$FE~Ce$9$k!V$9$Y$F$N!W%Q%1%C%H$NDL2a$b(B
$B5v2D$7$F$7$^$$(B, "deny_incoming" $B$N5!G=$rL58z$J$b$N$K$7$F$7$^$$$^$9(B.

Thus, users who are using the deny_incoming functionality in the
expectation that it provides a "deny by default" firewall which only
allows through packets known to be part of an existing NAT session,
are in fact allowing other types of unsolicited IP traffic into their
internal network.

$B$7$?$,$C$F(B, $B4{B8$N(B NAT $B%;%7%g%s$K4^$^$l$k%Q%1%C%H$N$_$NDL2a$r5v2D$9$k(B,
$B!V%G%U%)%k%H$G5qH]!W$N%U%!%$%"%&%)!<%k$r<B8=$9$k$?$a$K(B deny_incoming $B$r(B
$B;H$C$F$$$k%f!<%6$O(B, $B<B:]$K$OFbIt%M%C%H%o!<%/$KBP$7$F(B, $B$"$k<o$N0U?^$7$J$$(B
IP $B%Q%1%C%H$N?/F~$r5v$7$F$7$^$$$^$9(B.

The behaviour of ppp was corrected to only allow incoming packets
which are known to be part of a valid NAT session, which gives the
desired packet filtering behaviour in the general case.  Outgoing IP
traffic which is not understood by libalias (such as an outgoing IPSEC
packet part of a VPN) will cause a NAT session to be established which
will allow incoming packets with the corresponding source and
destination IP addresses and protocol number to pass, but all others
to be denied.

ppp $B$NF0:n$O0lHLE*$KK>$^$l$k$h$&$J%Q%1%C%H%U%#%k%?$NF0:n$r<B8=$9$k$h$&(B,
$BM-8z$J(B NAT $B%;%7%g%s$K4^$^$l$kE~Ce%Q%1%C%H$N$_$NDL2a$r5v2D$9$k$h$&$K(B
$B=$@5$5$l$^$7$?(B.  libalias $B$,G'<1$G$-$J$$308~$-$N(B IP $B%Q%1%C%H(B (VPN $B$K(B
$B;H$o$l$k308~$-$N(B IPSEC $B%Q%1%C%H$J$I(B) $B$O(B, $BBP1~$9$kAw?.85%"%I%l%9(B,
$BAw?.@h%"%I%l%9(B, $B%W%m%H%3%kHV9f$r;}$DE~Ce%Q%1%C%H$r5v2D$7(B, $B$=$NB>$r(B
$B5qH]$9$k(B NAT $B%;%7%g%s$r0l$D3NN)$7$^$9(B.

This behaviour may be sufficient for the security needs of many users,
although users with advanced filtering or security policy requirements
are advised to use a more configurable packet filter such as those
provided by ipfw(8) or ipf(8) which can meet their needs.

$B$3$NF0:n$O(B, $B$[$H$s$I$N%f!<%6$K$H$C$F%;%-%e%j%F%#E*$K==J,$J$b$N$G$"$k$H(B
$B;W$o$l$^$9$,(B, $BJ#;($J%U%#%k%?$d%;%-%e%j%F%#%]%j%7$,MW5a$5$l$k>l9g$O(B
ipfw(8) $B$d(B ipf(8) $B$,Ds6!$7$F$$$k(B, $B>\:Y$J@_Dj$,2DG=$J%Q%1%C%H%U%#%k%?$r(B
$BMxMQ$7$F$/$@$5$$(B.  $B$3$l$i$OJ#;($JMW5a$K$bBP1~$G$-$^$9(B.

The following released versions of FreeBSD are the only releases
vulnerable to this problem: 3.5, 3.5.1, 4.1, 4.1.1.  It was fixed in
the 4.1.1-STABLE branch prior to the release of FreeBSD 4.2-RELEASE.

$B$3$NLdBj$N1F6A$r<u$1$k(B FreeBSD $B%j%j!<%9$O(B, FreeBSD 3.5, 3.5.1, 4.1,
4.1.1 $B$N$_$G$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$G9T$J$o$l$^$7$?(B.

III. $B1F6AHO0O(B - Impact

Remote users can cause incoming traffic which is not part of an
existing NAT session to pass the NAT gateway, which may constitute a
breach of security policy.

$B4{B8$N(B NAT $B%;%7%g%s$K4^$^$l$J$$%j%b!<%H%f!<%6$+$i$NE~Ce%Q%1%C%H$O(B,
NAT $B%2!<%H%&%'%$$rDL2a$9$k$3$H$,$G$-$^$9(B.  $B$3$N%Q%1%C%H$NDL2a$O(B,
$B%;%-%e%j%F%#%]%j%7$KH?$9$k$b$N$G$"$k2DG=@-$,$"$j$^$9(B.

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

Use a true packet filter such as ipfw(8) or ipf(8) on the PPP gateway
to deny incoming traffic according to the desired security policy.

PPP $B%2!<%H%&%'%$$G(B ipfw(8) $B$d(B ipf(8) $B$H$$$C$?@lMQ$N%Q%1%C%H%U%#%k%?$r(B
$B;H$$(B, $B=jK>$N%;%-%e%j%F%#%]%j%7$KE,9g$9$k$h$&$KE~Ce%Q%1%C%H$r(B
$B5qH]$7$F$/$@$5$$(B.


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$^$9(B.

$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.
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.

ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:70/ppp.patch
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:70/ppp.patch.asc

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

# cd /usr/src/usr.sbin/ppp
# patch -p < /path/to/patch_or_advisory
# make depend && make all install

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

Index: nat_cmd.c
===================================================================
RCS file: /mnt/ncvs/src/usr.sbin/ppp/nat_cmd.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
- --- nat_cmd.c	2000/07/11 22:11:31	1.49
+++ nat_cmd.c	2000/10/30 18:02:01	1.50
@@ -421,7 +421,11 @@
       break;
 
     case PKT_ALIAS_IGNORED:
- -      if (log_IsKept(LogTCPIP)) {
+      if (PacketAliasSetMode(0, 0) & PKT_ALIAS_DENY_INCOMING) {
+        log_Printf(LogTCPIP, "NAT engine denied data:\n");
+        m_freem(bp);
+        bp = NULL;
+      } else if (log_IsKept(LogTCPIP)) {
         log_Printf(LogTCPIP, "NAT engine ignored data:\n");
         PacketCheck(bundle, MBUF_CTOP(bp), bp->m_len, NULL, NULL, NULL);
       }

$hrs: FreeBSD-SA/00:70,v 1.1 2000/11/19 20:27:34 hrs Exp $

----Next_Part(Mon_Nov_20_05:32:25_2000_41)----
