[Midnightbsd-cvs] src [7273] trunk/crypto/openssh: A programming error in the privileged monitor process of the sshd(8)

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Aug 25 18:08:49 EDT 2015


Revision: 7273
          http://svnweb.midnightbsd.org/src/?rev=7273
Author:   laffer1
Date:     2015-08-25 18:08:49 -0400 (Tue, 25 Aug 2015)
Log Message:
-----------
A programming error in the privileged monitor process of the sshd(8)
service may allow the username of an already-authenticated user to be
overwritten by the unprivileged child process.

A use-after-free error in the privileged monitor process of he sshd(8)
service may be deterministically triggered by the actions of a
compromised unprivileged child process.

A use-after-free error in the session multiplexing code in the sshd(8)
service may result in unintended termination of the connection.

Modified Paths:
--------------
    trunk/crypto/openssh/monitor.c
    trunk/crypto/openssh/monitor_wrap.c
    trunk/crypto/openssh/mux.c

Modified: trunk/crypto/openssh/monitor.c
===================================================================
--- trunk/crypto/openssh/monitor.c	2015-08-25 22:06:30 UTC (rev 7272)
+++ trunk/crypto/openssh/monitor.c	2015-08-25 22:08:49 UTC (rev 7273)
@@ -1027,9 +1027,7 @@
 int
 mm_answer_pam_init_ctx(int sock, Buffer *m)
 {
-
 	debug3("%s", __func__);
-	authctxt->user = buffer_get_string(m, NULL);
 	sshpam_ctxt = (sshpam_device.init_ctx)(authctxt);
 	sshpam_authok = NULL;
 	buffer_clear(m);
@@ -1111,14 +1109,16 @@
 int
 mm_answer_pam_free_ctx(int sock, Buffer *m)
 {
+	int r = sshpam_authok != NULL && sshpam_authok == sshpam_ctxt;
 
 	debug3("%s", __func__);
 	(sshpam_device.free_ctx)(sshpam_ctxt);
+	sshpam_ctxt = sshpam_authok = NULL;
 	buffer_clear(m);
 	mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m);
 	auth_method = "keyboard-interactive";
 	auth_submethod = "pam";
-	return (sshpam_authok == sshpam_ctxt);
+	return r;
 }
 #endif
 

Modified: trunk/crypto/openssh/monitor_wrap.c
===================================================================
--- trunk/crypto/openssh/monitor_wrap.c	2015-08-25 22:06:30 UTC (rev 7272)
+++ trunk/crypto/openssh/monitor_wrap.c	2015-08-25 22:08:49 UTC (rev 7273)
@@ -820,7 +820,6 @@
 
 	debug3("%s", __func__);
 	buffer_init(&m);
-	buffer_put_cstring(&m, authctxt->user);
 	mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_INIT_CTX, &m);
 	debug3("%s: waiting for MONITOR_ANS_PAM_INIT_CTX", __func__);
 	mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_INIT_CTX, &m);

Modified: trunk/crypto/openssh/mux.c
===================================================================
--- trunk/crypto/openssh/mux.c	2015-08-25 22:06:30 UTC (rev 7272)
+++ trunk/crypto/openssh/mux.c	2015-08-25 22:08:49 UTC (rev 7273)
@@ -633,7 +633,8 @@
 	u_int lport, cport;
 	int i, ret = 0, freefwd = 1;
 
-	fwd.listen_host = fwd.connect_host = NULL;
+	memset(&fwd, 0, sizeof(fwd));
+
 	if (buffer_get_int_ret(&ftype, m) != 0 ||
 	    (fwd.listen_host = buffer_get_string_ret(m, NULL)) == NULL ||
 	    buffer_get_int_ret(&lport, m) != 0 ||
@@ -783,7 +784,8 @@
 	int i, listen_port, ret = 0;
 	u_int lport, cport;
 
-	fwd.listen_host = fwd.connect_host = NULL;
+	memset(&fwd, 0, sizeof(fwd));
+
 	if (buffer_get_int_ret(&ftype, m) != 0 ||
 	    (fwd.listen_host = buffer_get_string_ret(m, NULL)) == NULL ||
 	    buffer_get_int_ret(&lport, m) != 0 ||



More information about the Midnightbsd-cvs mailing list