From sec@42.org  Mon Jun  5 17:35:48 2000
Return-Path: <sec@42.org>
Received: from matrix.42.org (matrix.42.org [194.246.250.200])
	by hub.freebsd.org (Postfix) with ESMTP id B874A37BEF9
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  5 Jun 2000 17:35:45 -0700 (PDT)
	(envelope-from sec@42.org)
Received: (from sec@localhost)
	by matrix.42.org (8.8.8/8.8.5) id CAA11698
	(sender <sec>); Tue, 6 Jun 2000 02:35:42 +0200 (CEST)
Message-Id: <200006060035.CAA11698@matrix.42.org>
Date: Tue, 6 Jun 2000 02:35:42 +0200 (CEST)
From: Stefan `Sec` Zehl <sec@42.org>
Reply-To: sec@42.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: localhost can be accessed via the network
X-Send-Pr-Version: 3.2

>Number:         19048
>Category:       kern
>Synopsis:       localhost can be accessed via the network
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 05 17:40:01 PDT 2000
>Closed-Date:    Tue Jun 6 00:06:37 PDT 2000
>Last-Modified:  Tue Jun 06 00:08:30 PDT 2000
>Originator:     Stefan `Sec` Zehl
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
>Environment:

FreeBSD machine with ethernet.

>Description:

I'm not sure wether this is a real bug. This is more of a question if this
should be changed.

You can access listening demons bound to localhost from another machine
on the same ip subnet. Some people do not expect this. :)

>How-To-Repeat:

I'm on my host 'yoda'

| yoda:~#telnet 127.0.0.1
| Trying 127.0.0.1...
| Connected to localhost.
| Escape character is '^]'.
| 
| FreeBSD/i386 (yoda) (ttypa)
| 
| login:
| telnet> q
| Connection closed.

I modify the routes a bit...

| yoda:~#route delete -host 127.0.0.1
| delete host 127.0.0.1

| yoda:~#route add -host 127.0.0.1 -gateway kenobi
| add host 127.0.0.1

Now localhost is somewhere else :)

| yoda:~#telnet 127.0.0.1
| Trying 127.0.0.1...
| Connected to localhost.
| Escape character is '^]'.
| 
| FreeBSD/i386 (kenobi) (ttype)
| 
| login:
| telnet> q
| Connection closed.

I even tried it with program listening only on localhost:8888 on kenobi

| yoda:~#telnet 127.0.0.1 8888
| Trying 127.0.0.1...
| Connected to localhost.
| Escape character is '^]'.
| Hallo, hier ist kenobi-localhost
| Connection closed by foreign host.

Of course this usually doesn't matter because if you have bad guys on your
ethernet, you usually have worse problems already :)

But quite some people expect programs listening on localhost to be only
accessible from localhost.

>Fix:
	
filter 127/8 somewhere in the kernel?

if this is not deemed right, you can of course use ipfilter / ipfw to block
these packets.

>Release-Note:
>Audit-Trail:

From: Will Andrews <andrews@technologist.com>
To: Stefan `Sec` Zehl <sec@42.org>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/19048: localhost can be accessed via the network
Date: Mon, 5 Jun 2000 21:32:47 -0400

 On Tue, Jun 06, 2000 at 02:35:42AM +0200, Stefan `Sec` Zehl wrote:
 > filter 127/8 somewhere in the kernel?
 > 
 > if this is not deemed right, you can of course use ipfilter / ipfw to block
 > these packets.
 
 It's default in rc.firewall:
 
 00200      0         0 deny ip from any to 127.0.0.0/8
 
 -- 
 Will Andrews <andrews@technologist.com>
 GCS/E/S @d- s+:+>+:- a--->+++ C++ UB++++ P+ L- E--- W+++ !N !o ?K w---
 ?O M+ V-- PS+ PE++ Y+ PGP+>+++ t++ 5 X++ R+ tv+ b++>++++ DI+++ D+ 
 G++>+++ e->++++ h! r-->+++ y?
 
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Tue Jun 6 00:06:37 PDT 2000 
State-Changed-Why:  
Default ipfw(8) configuration blocks this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19048 
>Unformatted:
