Operating System:

Published:

24 July 2001

Protect yourself against future threats.

-----BEGIN PGP SIGNED MESSAGE-----

===========================================================================
             AUSCERT External Security Bulletin Redistribution

             ESB-2001.310 -- NetBSD Security Advisory 2001-010
           sshd(8) "cookies" file mishandling on X11 forwarding
                               25 July 2001

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:                sshd(8)
Vendor:                 NetBSD
Operating System:       NetBSD-current
                        NetBSD 1.5
Impact:                 Delete Arbitrary Files
Access Required:        Existing Account

- --------------------------BEGIN INCLUDED TEXT--------------------

- -----BEGIN PGP SIGNED MESSAGE-----

                 NetBSD Security Advisory 2001-010
                 =================================

Topic:		sshd(8) "cookies" file mishandling on X11 forwarding

Version:	NetBSD-current:	/usr/sbin/sshd from source before June 14, 2001
		NetBSD 1.5:	affected
		pkgsrc:		openssh packages prior to 2.9p2 (2.9p2 is safe)

Severity:	rogue local users can remove files abusing root privilege

Fixed:		NetBSD-current:		June 14, 2001
		NetBSD-1.5 branch:	June 25, 2001 (1.5.1 includes the fix)
		pkgsrc openssh:		openssh-2.9p2 corrects this issue

Abstract
========

sshd(8) allows users to delete files named "cookies" from arbitrary
directories if X11 forwarding is enabled.  Therefore, rogue local
users can abuse this to remove any file named "cookies" using root
privileges.

X11 forwarding is disabled by default. Therefore, the default
installation of NetBSD is not vulnerable to this attack.  However,
we suggest upgrading the sshd(8) binary for safety.


Solutions and Workarounds
=========================

The problem can be remedied by either changing configuration, or
replacing the sshd(8) binary.  It is recommended to replace the sshd(8)
binary, as it will remove any future possibility of re-enabling the
vulnerability by mistake.

After the upgrade or configuration changes, make sure you kill the old
running instance of sshd(8), and restart it.


How to determine if your sshd(8) binary is vulnerable:

Invoke sshd as "sshd -V" (actually -V is an invalid argument, but sshd
does not offer a 'usage' flag, you can use an invalid argument for
checking the version number).

For in-tree sshd (/usr/sbin/sshd) on NetBSD-current, if the version
number string shows a version/date prior to the following, your binary
is vulnerable:
	sshd version OpenSSH_2.9 NetBSD_Secure_Shell-20010614

For in-tree sshd (/usr/sbin/sshd) on NetBSD 1.5 branch (like 1.5.1 release),
if the version number string shows a version/date prior to the following,
your binary is vulnerable:
	sshd version OpenSSH_2.5.1 NetBSD_Secure_Shell-20010614

For sshd from pkgsrc (/usr/pkg/sbin/sshd), if the version number string
shows a version prior to the following, your binary is vulnerable:
	sshd version OpenSSH_2.9p2


Configuration change:

If you cannot upgrade the sshd(8) binary, make sure you have
"X11Forwarding no" in your system-wide sshd configuration file.  The
configuration file is located at /etc/sshd_config (for pkgsrc) or
/etc/sshd.conf (in-tree sshd).


For all NetBSD releases:

If you are using openssh from pkgsrc, upgrade it to openssh-2.9p2 or higher.
Make sure you have removed older sshd(8) binaries.

If you are using ssh from pkgsrc (security/ssh, ssh.com implementation),
migrate to openssh from pkgsrc (security/openssh).

If you are using in-tree sshd (/usr/sbin/sshd), you may want to install
openssh pkgsrc (2.9p2 or later) and use /usr/pkg/sbin/sshd instead of
/usr/sbin/sshd.


For NetBSD-current:

If you are using the in-tree sshd(8) in /usr/sbin/sshd, upgrade the
binary using source code more recent than June 14, 2001.  If you are
using anonymous CVS, the following steps should upgrade the binaries.
	# cd src
	# cvs update -d -P crypto/dist/ssh usr.bin/ssh
	# cd usr.bin/ssh
	# make cleandir; make obj; make dependall
	# make install


For NetBSD 1.5:

If you are using the in-tree sshd(8) in /usr/sbin/sshd, upgrade the
binary using source code more recent than June 25, 2001.  If you are
using anonymous CVS, the following steps should upgrade the binaries.
	# cd src
	# cvs update -d -P -r netbsd-1-5 crypto/dist/ssh usr.bin/ssh
	# cd usr.bin/ssh
	# make cleandir; make obj; make dependall
	# make install

NetBSD 1.5.1 is not vulnerable.


Thanks To
=========

OpenSSH team, including markus@openbsd.org.
zen-parse@gmx.net, reported the issue on bugtraq mailing list.


Revision History
================

	2001-07-20	Initial revision


More Information
================

An up-to-date PGP signed copy of this release will be maintained at
  ftp://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2001-010.txt.asc

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.ORG/ and http://www.NetBSD.ORG/Security/.


Copyright 2001, The NetBSD Foundation, Inc.  All Rights Reserved.

$NetBSD: NetBSD-SA2001-010.txt,v 1.9 2001/07/20 01:16:23 lukem Exp $
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see http://www.gnupg.org

iQCVAwUBO1eSED5Ru2/4N2IFAQFGfQP+Izq8k/1uzFaRDACLs2jE8SouUv/IjuMc
4//kcUn8YIb4szdxi2oSUJJ07d8/hs3BWdtwutEGKxQ+u6P7WJG7qlY32OirE9c8
fSClnYBd4/URAqui6wv5diWT+Lt2CWgA+jL38S8q9C3Nn9kHYuAQLYx3wbStk3DW
9kJITvcTko0=
=sETb
- -----END PGP SIGNATURE-----

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content.  The decision to use any or all of this information is
the responsibility of each user or organisation, and should be done so in
accordance with site policies and procedures.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the original authors to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

	http://www.auscert.org.au/Information/advisories.html

If you believe that your system has been compromised, contact AusCERT or
your representative in FIRST (Forum of Incident Response and Security
Teams).

Internet Email: auscert@auscert.org.au
Facsimile:	(07) 3365 7031
Telephone:	(07) 3365 4417 (International: +61 7 3365 4417)
		AusCERT personnel answer during Queensland business hours
		which are GMT+10:00 (AEST).
		On call after hours for emergencies.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key

iQCVAwUBO16f/ih9+71yA2DNAQG+KwQAh8w0eNKRA9kkN9Vl9Y8rcrdkiCcA5I4v
qrMJjYlne9QD1O3vkisCSoUZ9rfhNlLVeMT/QF2uwVusdjily4Fy4Qkjb8OPvBAm
SwOUoZmeR/AJOlLLWg8owInARyh5805J8GAgfRSjZ/PbTlVQCii7PJ84/8W4DRs9
X7jKgSE56Q8=
=Xk7n
-----END PGP SIGNATURE-----