Subject: NetBSD Security Advisory 2001-010: sshd(8) "cookies" file mishandling on X11 forwarding
To: None <netbsd-announce@netbsd.org>
From: NetBSD Security Officer <security-officer@netbsd.org>
List: netbsd-announce
Date: 07/24/2001 14:56:45
-----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-----