TUCoPS :: Unix :: General :: n-151.txt


TUCoPS :: Unix :: General :: n-151.txt

OpenSSH Buffer Management error (CIAC N-151)

 __________________________________________________________
 The U.S. Department of Energy
 Computer Incident Advisory Capability
 ___ __ __ _ ___
 / | /_\ /
 \___ __|__ / \ \___
 __________________________________________________________
 INFORMATION BULLETIN
 OpenSSH Buffer Management Error
September 17, 2003 17:00 GMT Number N-151
[REVISED 22 Sept 2003]
[REVISED 23 Sept 2003]
[REVISED 1 Oct 2003]
[REVISED 2 Oct 2003]
[REVISED 27 Oct 2003]
______________________________________________________________________________
PROBLEM: OpenSSH has announced an upgrade that fixes a buffer management 
 error. When a function that expands the size of a buffer 
 detects that the new size will be greater then 10Meg it 
 generates a fatal error. When the error is generated, the 
 function incorrectly sets the size of the allocated buffer to a 
 value larger than the actual allocation. The fatal error 
 processing routines will then attempt to deallocate more memory 
 than was allocated. 
PLATFORM: All systems using versions of OpenSSH earlier than 3.7 
 Hewlett Packard HP-UX B.11.00, B.11.11, B.11.22 only with the
 T1471AA HP-UX Secure Sheel product installed.
 Mac OS X versions prior to 10.2.8
 IRIX 6.5.22
 SPARC Solaris 9
 x86 Solaris 9
 Red Hat Linux products
DAMAGE: Could possibly cause a system to crash. 
SOLUTION: Upgrade to OpenSSH version 3.7.1.
 Download and install appropriate files from appropriate vendor.
______________________________________________________________________________
VULNERABILITY The risk is LOW. There are no known exploits. We believe it is 
ASSESSMENT: unlikely that this problem can be exploited. If it can be 
 exploited, it might be possible to crash a system that does not 
 use protected memory (Windows 95, 98, ME). On systems with 
 protected memory (UNIX, Linux, Windows NT, 2000, XP) you might 
 be able to crash ssh but it is already shutting down because of 
 the fatal error. 
______________________________________________________________________________
LINKS: 
 CIAC BULLETIN: http://www.ciac.org/ciac/bulletins/n-151.shtml 
 ORIGINAL BULLETIN: http://www.openssh.com/txt/buffer.adv 
 ADDITIONAL LINKS: http://www.cert.org/advisories/CA-2003-24.html
 RED HAT
 https://rhn.redhat.com/errata/RHSA-2003-279.html
 https://rhn.redhat.com/errata/RHSA-2003-280.html
 CISCO
 http://www.cisco.com/warp/public/707/cisco-sa-20030917-
 openssh.shtml
 Visit HEWLETT PACKARD Subscription Service for:
 HPSBUX0309-282 (SSRT3629)
 Apple Security Advisory - Mac OS X 10.2.8 (APPLE-SA-2003年09月22日)
 http://net-security.org/advisory.php?id=2546
 http://docs.info.apple.com/article.html?artnum=61798
 SGI Security Advisory 20030904-01-P
 http://www.sgi.com/support/security/advisories.html
 Sun Alert ID: 56861
 http://www.sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsalert%
 2F56861&zone_32=category%3Asecurity
______________________________________________________________________________
REVISION HISTORY: 
9/22/03 - Updated PLATFORM section; SOLUTION section; and added link for Hewlett 
 Packard HPSBUX0309-282 (SSRT3629).
 
9/23/03 - Updated PLATFORM section; SOLUTION section; and added link for Apple 
 Security Advisory - Mac OS X 10.2.8 (APPLE-SA-2003年09月22日).
 
10/1/03 - Updated PLATFORM section; added link for SGI Security Advisory
 20030904-01-P.
10/2/03 - Added link for Sun Alert ID: 56861 and updated PLATFORM section.
10/27/03 - Added link for Red Hat Advisory RHSA-2003:280 for information on patches 
 to their Red Hat Enterprise Linux products.
				
							
The description of this vulnerability exposes the fact that if a buffer in 
sshd can be expanded beyond about 10Meg, that sshd will shut down by design. 
It may be possible to exploit this feature but only to the copy of sshd that 
you are connected to. That is, you can possibly kill your own process.
[****** Start OpenSSH Bulletin ******]
Subject: OpenSSH Security Advisory: buffer.adv
This is the 2nd revision of the Advisory.
This document can be found at: http://www.openssh.com/txt/buffer.adv
1. Versions affected:
 All versions of OpenSSH's sshd prior to 3.7.1 contain buffer
 management errors. It is uncertain whether these errors are
 potentially exploitable, however, we prefer to see bugs
 fixed proactively.
 Other implementations sharing common origin may also have
 these issues.
2. Solution:
	Upgrade to OpenSSH 3.7.1 or apply the following patch.
===================================================================
Appendix A: patch for OpenSSH 3.6.1 and earlier
Index: buffer.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/buffer.c,v
retrieving revision 1.16
retrieving revision 1.18
diff -u -r1.16 -r1.18
--- buffer.c	26 Jun 2002 08:54:18 -0000	1.16
+++ buffer.c	16 Sep 2003 21:02:39 -0000	1.18
@@ -23,8 +23,11 @@
 void
 buffer_init(Buffer *buffer)
 {
-	buffer->alloc = 4096;
-	buffer->buf = xmalloc(buffer->alloc);
+	const u_int len = 4096;
+
+	buffer->alloc = 0;
+	buffer->buf = xmalloc(len);
+	buffer->alloc = len;
 	buffer->offset = 0;
 	buffer->end = 0;
 }
@@ -34,8 +37,10 @@
 void
 buffer_free(Buffer *buffer)
 {
-	memset(buffer->buf, 0, buffer->alloc);
-	xfree(buffer->buf);
+	if (buffer->alloc > 0) {
+		memset(buffer->buf, 0, buffer->alloc);
+		xfree(buffer->buf);
+	}
 }
 
 /*
@@ -69,6 +74,7 @@
 void *
 buffer_append_space(Buffer *buffer, u_int len)
 {
+	u_int newlen;
 	void *p;
 
 	if (len > 0x100000)
@@ -98,11 +104,13 @@
 		goto restart;
 	}
 	/* Increase the size of the buffer and retry. */
-	buffer->alloc += len + 32768;
-	if (buffer->alloc > 0xa00000)
+	
+	newlen = buffer->alloc + len + 32768;
+	if (newlen > 0xa00000)
 		fatal("buffer_append_space: alloc %u not supported",
-		 buffer->alloc);
-	buffer->buf = xrealloc(buffer->buf, buffer->alloc);
+		 newlen);
+	buffer->buf = xrealloc(buffer->buf, newlen);
+	buffer->alloc = newlen;
 	goto restart;
 	/* NOTREACHED */
 }
Index: channels.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/channels.c,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -r1.194 -r1.195
--- channels.c	29 Aug 2003 10:04:36 -0000	1.194
+++ channels.c	16 Sep 2003 21:02:40 -0000	1.195
@@ -228,12 +228,13 @@
 	if (found == -1) {
 		/* There are no free slots. Take last+1 slot and expand the 
 array. */
 		found = channels_alloc;
-		channels_alloc += 10;
 		if (channels_alloc > 10000)
 			fatal("channel_new: internal error: channels_alloc %d "
 			 "too big.", channels_alloc);
+		channels = xrealloc(channels,
+		 (channels_alloc + 10) * sizeof(Channel *));
+		channels_alloc += 10;
 		debug2("channel: expanding %d", channels_alloc);
-		channels = xrealloc(channels, channels_alloc * sizeof
 (Channel *));
 		for (i = found; i < channels_alloc; i++)
 			channels[i] = NULL;
 	}
===================================================================
Appendix B: patch for OpenSSH 3.7
Index: buffer.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/buffer.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- buffer.c	16 Sep 2003 03:03:47 -0000	1.17
+++ buffer.c	16 Sep 2003 21:02:39 -0000	1.18
@@ -23,8 +23,11 @@
 void
 buffer_init(Buffer *buffer)
 {
-	buffer->alloc = 4096;
-	buffer->buf = xmalloc(buffer->alloc);
+	const u_int len = 4096;
+
+	buffer->alloc = 0;
+	buffer->buf = xmalloc(len);
+	buffer->alloc = len;
 	buffer->offset = 0;
 	buffer->end = 0;
 }
@@ -34,8 +37,10 @@
 void
 buffer_free(Buffer *buffer)
 {
-	memset(buffer->buf, 0, buffer->alloc);
-	xfree(buffer->buf);
+	if (buffer->alloc > 0) {
+		memset(buffer->buf, 0, buffer->alloc);
+		xfree(buffer->buf);
+	}
 }
 
 /*
Index: channels.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/channels.c,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -r1.194 -r1.195
--- channels.c	29 Aug 2003 10:04:36 -0000	1.194
+++ channels.c	16 Sep 2003 21:02:40 -0000	1.195
@@ -228,12 +228,13 @@
 	if (found == -1) {
 		/* There are no free slots. Take last+1 slot and expand the 
 array. */
 		found = channels_alloc;
-		channels_alloc += 10;
 		if (channels_alloc > 10000)
 			fatal("channel_new: internal error: channels_alloc %d "
 			 "too big.", channels_alloc);
+		channels = xrealloc(channels,
+		 (channels_alloc + 10) * sizeof(Channel *));
+		channels_alloc += 10;
 		debug2("channel: expanding %d", channels_alloc);
-		channels = xrealloc(channels, channels_alloc * sizeof
 (Channel *));
 		for (i = found; i < channels_alloc; i++)
 			channels[i] = NULL;
 	}
===================================================================
[****** End OpenSSH Bulletin ******]
_______________________________________________________________________________
CIAC wishes to acknowledge the contributions of OpenSSH for the 
information contained in this bulletin.
_______________________________________________________________________________
CIAC, the Computer Incident Advisory Capability, is the computer
security incident response team for the U.S. Department of Energy
(DOE) and the emergency backup response team for the National
Institutes of Health (NIH). CIAC is located at the Lawrence Livermore
National Laboratory in Livermore, California. CIAC is also a founding
member of FIRST, the Forum of Incident Response and Security Teams, a
global organization established to foster cooperation and coordination
among computer security teams worldwide.
CIAC services are available to DOE, DOE contractors, and the NIH. CIAC
can be contacted at:
 Voice: +1 925-422-8193 (7x24)
 FAX: +1 925-423-8002
 STU-III: +1 925-423-2604
 E-mail: ciac@ciac.org
Previous CIAC notices, anti-virus software, and other information are
available from the CIAC Computer Security Archive.
 World Wide Web: http://www.ciac.org/
 Anonymous FTP: ftp.ciac.org
PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing
communities receive CIAC bulletins. If you are not part of these
communities, please contact your agency's response team to report
incidents. Your agency's team will coordinate with CIAC. The Forum of
Incident Response and Security Teams (FIRST) is a world-wide
organization. A list of FIRST member organizations and their
constituencies can be obtained via WWW at http://www.first.org/.
This document was prepared as an account of work sponsored by an
agency of the United States Government. Neither the United States
Government nor the University of California nor any of their
employees, makes any warranty, express or implied, or assumes any
legal liability or responsibility for the accuracy, completeness, or
usefulness of any information, apparatus, product, or process
disclosed, or represents that its use would not infringe privately
owned rights. Reference herein to any specific commercial products,
process, or service by trade name, trademark, manufacturer, or
otherwise, does not necessarily constitute or imply its endorsement,
recommendation or favoring by the United States Government or the
University of California. The views and opinions of authors expressed
herein do not necessarily state or reflect those of the United States
Government or the University of California, and shall not be used for
advertising or product endorsement purposes.
LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC)
N-141: Timing based attack vulnerabilities in the JAVA Secure Socket Extension
N-142: Microsoft Word Macros Vulnerability
N-143: Microsoft WordPerfect Converter Buffer Overrun Vulnerability
N-144: Microsoft Visual Basic Buffer Overrun Vulnerability
N-145: Microsoft Access Snapshot View Buffer Overrun Vulnerability
N-146: Apache 2.0.47 Release Fixes Security Vulnerabilities
N-147: Hewlett Packard Potential Security Vulnerability B.11.11 DCE
N-148: Sun Security Issue Involving the Solaris sadmind(1M) Daemon
N-149: Sendmail 8.12.9 Prescan Bug
N-150: Red Hat Updated KDE packages fix security issues

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2025 AOH

AltStyle によって変換されたページ (->オリジナル) /