From owner-freebsd-net Mon Jul 29 8: 4:43 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA91037B400; Mon, 29 Jul 2002 08:04:41 -0700 (PDT) Received: from comp.chem.msu.su (comp-ext.chem.msu.su [158.250.32.157]) by mx1.FreeBSD.org (Postfix) with ESMTP id 51DDE43E31; Mon, 29 Jul 2002 08:04:38 -0700 (PDT) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.11.6/8.11.6) id g6TF4aI38174; Mon, 29 Jul 2002 19:04:36 +0400 (MSD) (envelope-from yar) Date: Mon, 29 Jul 2002 19:04:35 +0400 From: Yar Tikhiy To: Ruslan Ermilov Cc: net@FreeBSD.ORG Subject: Re: ftpd(8) DoS: SIZE in ASCII mode Message-ID: <20020729190435.C33729@comp.chem.msu.su> References: <20020726155745.B2089@comp.chem.msu.su> <20020726202255.GA9263@sunbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020726202255.GA9263@sunbay.com>; from ru@FreeBSD.ORG on Fri, Jul 26, 2002 at 11:22:55PM +0300 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, Jul 26, 2002 at 11:22:55PM +0300, Ruslan Ermilov wrote: > On Fri, Jul 26, 2002 at 03:57:45PM +0400, Yar Tikhiy wrote: > > > > I've been pointed out by Maxim Konovalov recently that our stock > > ftpd(8) allowed an easy DoS attack against a server running it by > > issuing numerous "SIZE" commands on huge files when in ASCII mode. > > In this case, ftpd(8) has to read a whole file instead of just > > issuing a single stat(2) syscall, thus eating up the server's > > disk bandwidth. > > > > The obvious solution is to disable the "SIZE" command when in ASCII > > mode. So I'd like to ask the community whether anyone thinks there > > must be an option to enable it back. Personally, I feel the command > > must be disabled completely (for ASCII mode, of course) since I see > > no good use for it at all. > > > How about going the lukemftpd(8) way? > > if (stbuf.st_size > 10240) { > reply(550, "%s: file too large for SIZE.", filename); > (void) fclose(fin); > return; > } It looks like a nice approach at the first glance. I still doubt type A SIZE necessity at all, but let it be this way if noone objects. -- Yar To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message