From owner-freebsd-net Fri Jul 26 13:23: 8 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 2840437B400; Fri, 26 Jul 2002 13:23:05 -0700 (PDT) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD60143E77; Fri, 26 Jul 2002 13:23:00 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g6QKMtM11231; Fri, 26 Jul 2002 23:22:55 +0300 (EEST) (envelope-from ru) Date: Fri, 26 Jul 2002 23:22:55 +0300 From: Ruslan Ermilov To: Yar Tikhiy Cc: net@FreeBSD.ORG Subject: Re: ftpd(8) DoS: SIZE in ASCII mode Message-ID: <20020726202255.GA9263@sunbay.com> References: <20020726155745.B2089@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline In-Reply-To: <20020726155745.B2089@comp.chem.msu.su> User-Agent: Mutt/1.3.99i 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 --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 26, 2002 at 03:57:45PM +0400, Yar Tikhiy wrote: > Hi everybody, >=20 > 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. >=20 > 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. >=20 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; } Cheers, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --nFreZHaLTZJo0R7j Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9Qa+fUkv4P6juNwoRAqo2AKCE5oUO7a4IQvJImtUast7R2cAoigCePlG6 zXYc+Ttujr3GuNtPK6UmM9E= =Lf8d -----END PGP SIGNATURE----- --nFreZHaLTZJo0R7j-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message