[Pkg-samba-maint] [samba] 01/04: Import Debian changes 2:3.6.6-6+deb7u14

Mathieu Parent sathieu at moszumanska.debian.org
Tue Nov 21 09:53:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

sathieu pushed a commit to annotated tag debian/2%3.6.6-6+deb7u15
in repository samba.

commit ba2a79a85dc0cb213b6886eee9f5fbee3a7ebfa1
Author: Guido Günther <agx at sigxcpu.org>
Date:   Fri Sep 22 10:22:15 2017 +0200

    Import Debian changes 2:3.6.6-6+deb7u14
    
    samba (2:3.6.6-6+deb7u14) wheezy-security; urgency=medium
    
      * CVE-2017-12150: SMB1/2/3 connections may not require signing where they
        should
      * CVE-2017-12163: Client with write access to a share can cause server
        memory contents to be written into a file or printer.
---
 debian/changelog                             |   9 ++
 debian/patches/security/CVE-2017-12150.patch |  81 ++++++++++++++++
 debian/patches/security/CVE-2017-12163.patch | 138 +++++++++++++++++++++++++++
 debian/patches/series                        |   2 +
 4 files changed, 230 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 3fb765e..223387e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+samba (2:3.6.6-6+deb7u14) wheezy-security; urgency=medium
+
+  * CVE-2017-12150: SMB1/2/3 connections may not require signing where they
+    should
+  * CVE-2017-12163: Client with write access to a share can cause server
+    memory contents to be written into a file or printer.
+
+ -- Guido Günther <agx at sigxcpu.org>  Fri, 22 Sep 2017 10:22:15 +0200
+
 samba (2:3.6.6-6+deb7u13) wheezy-security; urgency=medium
 
   * Non-maintainer upload by a now maintainer.
diff --git a/debian/patches/security/CVE-2017-12150.patch b/debian/patches/security/CVE-2017-12150.patch
new file mode 100644
index 0000000..c75d75a
--- /dev/null
+++ b/debian/patches/security/CVE-2017-12150.patch
@@ -0,0 +1,81 @@
+From: =?utf-8?q?Guido_G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Wed, 20 Sep 2017 20:01:34 +0200
+Subject: CVE-2017-12150
+
+These are the three upstream patches
+
+  From: Stefan Metzmacher <metze at samba.org>
+  Subject: CVE-2017-12150: s3:lib: get_cmdline_auth_info_signing_state use Required for smb_encrypt
+
+  This is an addition to the fixes for CVE-2015-5296.
+
+  It applies to smb2mount -e, smbcacls -e and smbcquotas -e.
+
+  BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997
+
+
+  From: Stefan Metzmacher <metze at samba.org>
+  Subject: CVE-2017-12150: libgpo: make use of Required for SMB signing in gpo_connect_server()
+
+  It's important that we use a signed connection to get the GPOs!
+
+  BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997
+
+  Signed-off-by: Stefan Metzmacher <metze at samba.org>
+  Backported-by: Andreas Schneider <asn at samba.org>
+
+
+  From: Stefan Metzmacher <metze at samba.org>
+  Subject: CVE-2017-12150: s3:libsmb: only fallback to anonymous if authentication was not requested
+
+  With forced encryption or required signing we should also don't fallback.
+
+  BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997
+
+---
+ libgpo/gpo_fetch.c         | 2 +-
+ source3/lib/util_cmdline.c | 3 +++
+ source3/libsmb/clidfs.c    | 2 ++
+ 3 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/libgpo/gpo_fetch.c b/libgpo/gpo_fetch.c
+index 3cfe1d5..af012e0 100644
+--- a/libgpo/gpo_fetch.c
++++ b/libgpo/gpo_fetch.c
+@@ -151,7 +151,7 @@ static NTSTATUS gpo_connect_server(ADS_STRUCT *ads, struct loadparm_context *lp_
+ 			ads->auth.password,
+ 			CLI_FULL_CONNECTION_USE_KERBEROS |
+ 			CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS,
+-			Undefined);
++			Required);
+ 	if (!NT_STATUS_IS_OK(result)) {
+ 		DEBUG(10,("check_refresh_gpo: "
+ 				"failed to connect: %s\n",
+diff --git a/source3/lib/util_cmdline.c b/source3/lib/util_cmdline.c
+index cb0b79a..3178c84 100644
+--- a/source3/lib/util_cmdline.c
++++ b/source3/lib/util_cmdline.c
+@@ -122,6 +122,9 @@ bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
+ 
+ int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info)
+ {
++	if (auth_info->smb_encrypt) {
++		return Required;
++	}
+ 	return auth_info->signing_state;
+ }
+ 
+diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
+index f153b6b..35d2eb6 100644
+--- a/source3/libsmb/clidfs.c
++++ b/source3/libsmb/clidfs.c
+@@ -202,7 +202,9 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
+ 		/* If a password was not supplied then
+ 		 * try again with a null username. */
+ 		if (password[0] || !username[0] ||
++			force_encrypt || client_is_signing_mandatory(c) ||
+ 			get_cmdline_auth_info_use_kerberos(auth_info) ||
++			get_cmdline_auth_info_use_ccache(auth_info) ||
+ 			!NT_STATUS_IS_OK(cli_session_setup(c, "",
+ 				    		"", 0,
+ 						"", 0,
diff --git a/debian/patches/security/CVE-2017-12163.patch b/debian/patches/security/CVE-2017-12163.patch
new file mode 100644
index 0000000..cd03b9c
--- /dev/null
+++ b/debian/patches/security/CVE-2017-12163.patch
@@ -0,0 +1,138 @@
+From: =?utf-8?q?Guido_G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Wed, 20 Sep 2017 20:02:03 +0200
+Subject: CVE-2017-12163: s3:smbd: Prevent client short SMB1 write from
+ writing server memory to file.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=13020
+
+Author: Jeremy Allison <jra at samba.org>
+Signed-off-by: Jeremy Allison <jra at samba.org>
+Signed-off-by: Stefan Metzmacher <metze at samba.org>
+---
+ source3/smbd/reply.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 50 insertions(+)
+
+diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
+index ac471aa..b9694ee 100644
+--- a/source3/smbd/reply.c
++++ b/source3/smbd/reply.c
+@@ -3967,6 +3967,9 @@ void reply_writebraw(struct smb_request *req)
+ 	}
+ 
+ 	/* Ensure we don't write bytes past the end of this packet. */
++	/*
++	 * This already protects us against CVE-2017-12163.
++	 */
+ 	if (data + numtowrite > smb_base(req->inbuf) + smb_len(req->inbuf)) {
+ 		reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ 		error_to_writebrawerr(req);
+@@ -4068,6 +4071,11 @@ void reply_writebraw(struct smb_request *req)
+ 			exit_server_cleanly("secondary writebraw failed");
+ 		}
+ 
++		/*
++		 * We are not vulnerable to CVE-2017-12163
++		 * here as we are guarenteed to have numtowrite
++		 * bytes available - we just read from the client.
++		 */
+ 		nwritten = write_file(req,fsp,buf+4,startpos+nwritten,numtowrite);
+ 		if (nwritten == -1) {
+ 			TALLOC_FREE(buf);
+@@ -4149,6 +4157,7 @@ void reply_writeunlock(struct smb_request *req)
+ 	connection_struct *conn = req->conn;
+ 	ssize_t nwritten = -1;
+ 	size_t numtowrite;
++	size_t remaining;
+ 	SMB_OFF_T startpos;
+ 	const char *data;
+ 	NTSTATUS status = NT_STATUS_OK;
+@@ -4181,6 +4190,17 @@ void reply_writeunlock(struct smb_request *req)
+ 	startpos = IVAL_TO_SMB_OFF_T(req->vwv+2, 0);
+ 	data = (const char *)req->buf + 3;
+ 
++	/*
++	 * Ensure client isn't asking us to write more than
++	 * they sent. CVE-2017-12163.
++	 */
++	remaining = smbreq_bufrem(req, data);
++	if (numtowrite > remaining) {
++		reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
++		END_PROFILE(SMBwriteunlock);
++		return;
++	}
++
+ 	if (!fsp->print_file && numtowrite > 0) {
+ 		init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
+ 		    (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
+@@ -4262,6 +4282,7 @@ void reply_write(struct smb_request *req)
+ {
+ 	connection_struct *conn = req->conn;
+ 	size_t numtowrite;
++	size_t remaining;
+ 	ssize_t nwritten = -1;
+ 	SMB_OFF_T startpos;
+ 	const char *data;
+@@ -4302,6 +4323,17 @@ void reply_write(struct smb_request *req)
+ 	startpos = IVAL_TO_SMB_OFF_T(req->vwv+2, 0);
+ 	data = (const char *)req->buf + 3;
+ 
++	/*
++	 * Ensure client isn't asking us to write more than
++	 * they sent. CVE-2017-12163.
++	 */
++	remaining = smbreq_bufrem(req, data);
++	if (numtowrite > remaining) {
++		reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
++		END_PROFILE(SMBwrite);
++		return;
++	}
++
+ 	if (!fsp->print_file) {
+ 		init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
+ 			(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
+@@ -4513,6 +4545,9 @@ void reply_write_and_X(struct smb_request *req)
+ 			return;
+ 		}
+ 	} else {
++		/*
++		 * This already protects us against CVE-2017-12163.
++		 */
+ 		if (smb_doff > smblen || smb_doff + numtowrite < numtowrite ||
+ 				smb_doff + numtowrite > smblen) {
+ 			reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+@@ -4882,6 +4917,7 @@ void reply_writeclose(struct smb_request *req)
+ {
+ 	connection_struct *conn = req->conn;
+ 	size_t numtowrite;
++	size_t remaining;
+ 	ssize_t nwritten = -1;
+ 	NTSTATUS close_status = NT_STATUS_OK;
+ 	SMB_OFF_T startpos;
+@@ -4915,6 +4951,17 @@ void reply_writeclose(struct smb_request *req)
+ 	mtime = convert_time_t_to_timespec(srv_make_unix_date3(req->vwv+4));
+ 	data = (const char *)req->buf + 1;
+ 
++	/*
++	 * Ensure client isn't asking us to write more than
++	 * they sent. CVE-2017-12163.
++	 */
++	remaining = smbreq_bufrem(req, data);
++	if (numtowrite > remaining) {
++		reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
++		END_PROFILE(SMBwriteclose);
++		return;
++	}
++
+ 	if (!fsp->print_file) {
+ 		init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
+ 		    (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
+@@ -5485,6 +5532,9 @@ void reply_printwrite(struct smb_request *req)
+ 
+ 	numtowrite = SVAL(req->buf, 1);
+ 
++	/*
++	 * This already protects us against CVE-2017-12163.
++	 */
+ 	if (req->buflen < numtowrite + 3) {
+ 		reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ 		END_PROFILE(SMBsplwr);
diff --git a/debian/patches/series b/debian/patches/series
index fd1a722..861db99 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -58,3 +58,5 @@ CVE-2017-2619-race-condition-fix.patch
 CVE-2017-2619-regression-bug-12721-fix.patch
 CVE-2017-2619-tests.patch
 CVE-2017-7494-samba3.6.x.patch
+security/CVE-2017-12150.patch
+security/CVE-2017-12163.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-samba/samba.git




More information about the Pkg-samba-maint mailing list