NetBSD-Announce archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

NetBSD Security Advisory 2010-008: sftp(1)/ftp(1)/glob(3) related resource exhaustion

Hash: SHA1

                 NetBSD Security Advisory 2010-008

Topic:          sftp(1)/ftp(1)/glob(3) related resource exhaustion

Version:        NetBSD-current: source prior to July 7, 2010
                NetBSD 5.0.2:           affected
                NetBSD 5.0:             affected
                NetBSD 4.0.1:           affected
                NetBSD 4.0:             affected

Severity:       remote sftp/ftp DoS attack

Fixed:          NetBSD-current:         Jul 7, 2010
                NetBSD-5 branch         Jul 20, 2010
                NetBSD-5-0 branch       Jul 20, 2010
                NetBSD-4 branch         Aug 5, 2010
                NetBSD-4-0 branch       Aug 5, 2010

Please note that NetBSD releases prior to 4.0 are no longer supported.
It is recommended that all users upgrade to a supported release.


In 2001 GLOB_LIMIT was added to glob(3) to limit the potential amount of
memory used by globbed patterns. Unfortunately this implementation had
many limitations and did not do enough to limit memory or CPU attacks.
This bug affects:

1. ftpd(8), where a user can DoS the ftp service or increase
   the load on the machine.

2. The secure ftp server sftp(1) which comes with OpenSSH. sftp(1) does not
   use GLOB_LIMIT to limit glob(3) patterns, so it can also be DoS'ed in
   more ways.

Technical Details

The limitations of GLOB_LIMIT were:

        - buffer limit was too high
        - it did not limit the number of readdir(3) calls
        - it did not limit the number of stat(2)

Both patterns like:




were not handled properly in all situations. One could DoS programs either
by memory exhaustion, or CPU utilization (many readdir(3) and stat(2) calls).

Solutions and Workarounds

- - Don't run ftpd/sftp
- - Patch, recompile and reinstall libc, restart ftpd.
  Patch, recompile and reinstall sftp.
  Patch, recompile and reinstall /rescue.

  CVS branch    file                                                    revision
  ------------- ----------------                                        --------
  HEAD          src/lib/libc/gen/glob.3                                 1.37
  HEAD          src/lib/libc/gen/glob.c                                 1.26
  HEAD          src/crypto/external/bsd/openssh/dist/sftp-glob.c        1.3
  HEAD          src/crypto/external/bsd/openssh/dist/sftp.c             1.3

  CVS branch    file                                            revision
  ------------- ----------------                                --------
  netbsd-5-0    src/lib/libc/gen/glob.3               
  netbsd-5-0    src/lib/libc/gen/glob.c               
  netbsd-5-0    src/crypto/dist/ssh/sftp.c            
  netbsd-5-0    src/crypto/dist/ssh/sftp-glob.c       

  netbsd-5      src/lib/libc/gen/glob.3               
  netbsd-5      src/lib/libc/gen/glob.c               
  netbsd-5      src/crypto/dist/ssh/sftp.c            
  netbsd-5      src/crypto/dist/ssh/sftp-glob.c       

  netbsd-4-0    src/lib/libc/gen/glob.3               
  netbsd-4-0    src/lib/libc/gen/glob.c               
  netbsd-4-0    src/crypto/dist/ssh/sftp.c            
  netbsd-4-0    src/crypto/dist/ssh/sftp-glob.c       

  netbsd-4      src/lib/libc/gen/glob.3               
  netbsd-4      src/lib/libc/gen/glob.c               
  netbsd-4      src/crypto/dist/ssh/sftp.c            
  netbsd-4      src/crypto/dist/ssh/sftp-glob.c       

The following instructions briefly summarize how to update and
recompile libc and sftp. In these instructions, replace:

  BRANCH   with the appropriate CVS branch (from the above table)
  FILES    with the file names for that branch (from the above table)

To update from CVS, re-build, and re-install libc and sftp:

* NetBSD-current:

        # cd src
        # cvs update -d -P -r BRANCH lib/libc/gen crypto/external/bsd/openssh
        # cd lib/libc
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../../crypto/external/bsd/openssh
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../../../../rescue
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install

* NetBSD 5.*/4.*:

        # cd src
        # cvs update -d -P -r BRANCH lib/libc/gen usr.bin/ssh/sftp-server
        # cd lib/libc
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../../usr.bin/ssh/sftp-server
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../../../rescue
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install

For more information on building (oriented towards rebuilding the
entire system, however) see:

Thanks To

Maksymilian Arciemowicz for finding, suggesting fixes, and testing.
Christos Zoulas for fixing the problem.

Revision History

        2010-10-06      Initial release

More Information

Advisories may be updated as new information becomes available.
The most recent version of this advisory (PGP signed) can be found at

Information about NetBSD and NetBSD security can be found at and

Copyright 2010, The NetBSD Foundation, Inc.  All Rights Reserved.
Redistribution permitted only in full, unmodified form.

$NetBSD: NetBSD-SA2010-008.txt,v 1.1 2010/10/06 20:54:45 tonnerre Exp $

Version: GnuPG v1.4.10 (NetBSD)


Home | Main Index | Thread Index | Old Index