diff -Nru samba-4.3.11+dfsg/debian/changelog samba-4.3.11+dfsg/debian/changelog --- samba-4.3.11+dfsg/debian/changelog 2017-07-04 12:01:55.000000000 +0000 +++ samba-4.3.11+dfsg/debian/changelog 2017-09-21 12:05:11.000000000 +0000 @@ -1,3 +1,53 @@ +samba (2:4.3.11+dfsg-0ubuntu0.14.04.12) trusty-security; urgency=medium + + * SECURITY UPDATE: SMB1/2/3 connections may not require signing where + they should + - debian/patches/CVE-2017-12150-1.patch: add SMB_SIGNING_REQUIRED to + source3/lib/util_cmdline.c. + - debian/patches/CVE-2017-12150-2.patch: add SMB_SIGNING_REQUIRED to + source3/libsmb/pylibsmb.c. + - debian/patches/CVE-2017-12150-3.patch: add SMB_SIGNING_REQUIRED to + libgpo/gpo_fetch.c. + - debian/patches/CVE-2017-12150-4.patch: add check for + NTLM_CCACHE/SIGN/SEAL to auth/credentials/credentials.c. + - debian/patches/CVE-2017-12150-5.patch: add + smbXcli_conn_signing_mandatory() to libcli/smb/smbXcli_base.*. + - debian/patches/CVE-2017-12150-6.patch: only fallback to anonymous if + authentication was not requested in source3/libsmb/clidfs.c. + - CVE-2017-12150 + * SECURITY UPDATE: SMB3 connections don't keep encryption across DFS + redirects + - debian/patches/CVE-2017-12151-1.patch: add + cli_state_is_encryption_on() helper function to + source3/libsmb/clientgen.c, source3/libsmb/proto.h. + - debian/patches/CVE-2017-12151-2.patch: make use of + cli_state_is_encryption_on() in source3/libsmb/clidfs.c, + source3/libsmb/libsmb_context.c. + - CVE-2017-12151 + * SECURITY UPDATE: Server memory information leak over SMB1 + - debian/patches/CVE-2017-12163.patch: prevent client short SMB1 write + from writing server memory to file in source3/smbd/reply.c. + - CVE-2017-12163 + + -- Marc Deslauriers Thu, 21 Sep 2017 08:05:11 -0400 + +samba (2:4.3.11+dfsg-0ubuntu0.14.04.11) trusty; urgency=medium + + * d/p/bug_1702529_EACCESS_with_rootshare.patch: + Handle corner case for / shares. (LP: #1702529) + + -- Dariusz Gadomski Wed, 23 Aug 2017 11:36:59 +0200 + +samba (2:4.3.11+dfsg-0ubuntu0.14.04.10) trusty-security; urgency=medium + + * SECURITY UPDATE: KDC-REP service name impersonation + - debian/patches/CVE-2017-11103.patch: use encrypted service + name rather than unencrypted (and therefore spoofable) version + in heimdal + - CVE-2017-11103 + + -- Steve Beattie Thu, 13 Jul 2017 14:06:03 -0700 + samba (2:4.3.11+dfsg-0ubuntu0.14.04.9) trusty-security; urgency=medium [ Andreas Hasenack ] diff -Nru samba-4.3.11+dfsg/debian/patches/bug_1702529_EACCESS_with_rootshare.patch samba-4.3.11+dfsg/debian/patches/bug_1702529_EACCESS_with_rootshare.patch --- samba-4.3.11+dfsg/debian/patches/bug_1702529_EACCESS_with_rootshare.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/bug_1702529_EACCESS_with_rootshare.patch 2017-08-23 13:39:46.000000000 +0000 @@ -0,0 +1,55 @@ +Description: s3/smbd: let non_widelink_open() chdir() to directories + If the caller passes O_DIRECTORY we just try to chdir() to smb_fname + directly, not to the parent directory. + + The security check in check_reduced_name() will continue to work, but + this fixes the case of an open() for a previous version of a + subdirectory that contains snapshopt. + +Author: Ralph Boehme +Origin: upstream, https://git.samba.org/?p=samba.git;a=commit;h=b886a9443d49f6e27fa3863d87c9e24d12e62874 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1702529 +Bug: https://bugzilla.samba.org/show_bug.cgi?id=12885 + +Index: samba-4.3.11+dfsg/source3/smbd/open.c +=================================================================== +--- samba-4.3.11+dfsg.orig/source3/smbd/open.c ++++ samba-4.3.11+dfsg/source3/smbd/open.c +@@ -520,12 +520,32 @@ static int non_widelink_open(struct conn + char *oldwd = NULL; + char *parent_dir = NULL; + const char *final_component = NULL; ++ bool is_directory = false; ++ bool ok; + +- if (!parent_dirname(talloc_tos(), +- smb_fname->base_name, +- &parent_dir, +- &final_component)) { +- goto out; ++#ifdef O_DIRECTORY ++ if (flags & O_DIRECTORY) { ++ is_directory = true; ++ } ++#endif ++ ++ if (is_directory) { ++ parent_dir = talloc_strdup(talloc_tos(), smb_fname->base_name); ++ if (parent_dir == NULL) { ++ saved_errno = errno; ++ goto out; ++ } ++ ++ final_component = "."; ++ } else { ++ ok = parent_dirname(talloc_tos(), ++ smb_fname->base_name, ++ &parent_dir, ++ &final_component); ++ if (!ok) { ++ saved_errno = errno; ++ goto out; ++ } + } + + oldwd = vfs_GetWd(talloc_tos(), conn); diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-11103.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-11103.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-11103.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-11103.patch 2017-07-13 21:05:49.000000000 +0000 @@ -0,0 +1,45 @@ +From 3799a32e41134a2dff797ebeacf5abdb8d332e6e Mon Sep 17 00:00:00 2001 +From: Jeffrey Altman +Date: Wed, 12 Apr 2017 15:40:42 -0400 +Subject: [PATCH] CVE-2017-11103: Orpheus' Lyre KDC-REP service name validation + +In _krb5_extract_ticket() the KDC-REP service name must be obtained from +encrypted version stored in 'enc_part' instead of the unencrypted version +stored in 'ticket'. Use of the unecrypted version provides an +opportunity for successful server impersonation and other attacks. + +Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams. + +Change-Id: I45ef61e8a46e0f6588d64b5bd572a24c7432547c + +BUG: https://bugzilla.samba.org/show_bug.cgi?id=12894 +(based on heimdal commit 6dd3eb836bbb80a00ffced4ad57077a1cdf227ea) + +Signed-off-by: Andrew Bartlett +Reviewed-by: Garming Sam +Reviewed-by: Stefan Metzmacher + +Autobuild-User(master): Stefan Metzmacher +Autobuild-Date(master): Wed Jul 12 17:44:50 CEST 2017 on sn-devel-144 +--- + source4/heimdal/lib/krb5/ticket.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/source4/heimdal/lib/krb5/ticket.c b/source4/heimdal/lib/krb5/ticket.c +index 064bbfb..5a317c7 100644 +--- a/source4/heimdal/lib/krb5/ticket.c ++++ b/source4/heimdal/lib/krb5/ticket.c +@@ -641,8 +641,8 @@ _krb5_extract_ticket(krb5_context context, + /* check server referral and save principal */ + ret = _krb5_principalname2krb5_principal (context, + &tmp_principal, +- rep->kdc_rep.ticket.sname, +- rep->kdc_rep.ticket.realm); ++ rep->enc_part.sname, ++ rep->enc_part.srealm); + if (ret) + goto out; + if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){ +-- +2.7.4 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-1.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-1.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-1.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-1.patch 2017-09-21 12:04:32.000000000 +0000 @@ -0,0 +1,34 @@ +From 428ede3dd3bbf3bba86ca1b321bedfcc9aebba79 Mon Sep 17 00:00:00 2001 +From: Stefan Metzmacher +Date: Thu, 3 Nov 2016 17:16:43 +0100 +Subject: [PATCH] CVE-2017-12150: s3:lib: get_cmdline_auth_info_signing_state + smb_encrypt SMB_SIGNING_REQUIRED + +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 + +Signed-off-by: Stefan Metzmacher +--- + source3/lib/util_cmdline.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/source3/lib/util_cmdline.c b/source3/lib/util_cmdline.c +index 80c3ecd..539fa55 100644 +--- a/source3/lib/util_cmdline.c ++++ b/source3/lib/util_cmdline.c +@@ -123,6 +123,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 SMB_SIGNING_REQUIRED; ++ } + return auth_info->signing_state; + } + +-- +1.9.1 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-2.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-2.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-2.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-2.patch 2017-09-21 12:04:35.000000000 +0000 @@ -0,0 +1,29 @@ +From 26b87d01b015c83a4670db62839f5c84b6e66478 Mon Sep 17 00:00:00 2001 +From: Stefan Metzmacher +Date: Fri, 9 Dec 2016 09:26:32 +0100 +Subject: [PATCH] CVE-2017-12150: s3:pylibsmb: make use of SMB_SIGNING_DEFAULT + for 'samba.samba3.libsmb_samba_internal' + +BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997 + +Signed-off-by: Stefan Metzmacher +--- + source3/libsmb/pylibsmb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c +index 0c5d7e9..97aa39e 100644 +--- a/source3/libsmb/pylibsmb.c ++++ b/source3/libsmb/pylibsmb.c +@@ -447,7 +447,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args, + cli_credentials_get_username(cli_creds), + cli_credentials_get_domain(cli_creds), + cli_credentials_get_password(cli_creds), +- 0, 0); ++ 0, SMB_SIGNING_DEFAULT); + if (!py_tevent_req_wait_exc(self->ev, req)) { + return -1; + } +-- +1.9.1 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-3.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-3.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-3.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-3.patch 2017-09-21 12:04:39.000000000 +0000 @@ -0,0 +1,31 @@ +From 95f6e5b574856453c3ef36ebe9ae86d8456e6404 Mon Sep 17 00:00:00 2001 +From: Stefan Metzmacher +Date: Mon, 12 Dec 2016 05:49:46 +0100 +Subject: [PATCH] CVE-2017-12150: libgpo: make use of SMB_SIGNING_REQUIRED 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 +--- + libgpo/gpo_fetch.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgpo/gpo_fetch.c b/libgpo/gpo_fetch.c +index 6b01544..cb969ff 100644 +--- a/libgpo/gpo_fetch.c ++++ b/libgpo/gpo_fetch.c +@@ -133,7 +133,7 @@ static NTSTATUS gpo_connect_server(ADS_STRUCT *ads, + ads->auth.password, + CLI_FULL_CONNECTION_USE_KERBEROS | + CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS, +- Undefined); ++ SMB_SIGNING_REQUIRED); + if (!NT_STATUS_IS_OK(result)) { + DEBUG(10,("check_refresh_gpo: " + "failed to connect: %s\n", +-- +1.9.1 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-4.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-4.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-4.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-4.patch 2017-09-21 12:04:43.000000000 +0000 @@ -0,0 +1,58 @@ +From b06322309752f3b666ad38f42ef2e96f1c41a24a Mon Sep 17 00:00:00 2001 +From: Stefan Metzmacher +Date: Tue, 29 Aug 2017 15:24:14 +0200 +Subject: [PATCH] CVE-2017-12150: auth/credentials: + cli_credentials_authentication_requested() should check for + NTLM_CCACHE/SIGN/SEAL + +BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997 + +Signed-off-by: Stefan Metzmacher +--- + auth/credentials/credentials.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c +index 3b7d42a..43e587a 100644 +--- a/auth/credentials/credentials.c ++++ b/auth/credentials/credentials.c +@@ -25,6 +25,7 @@ + #include "librpc/gen_ndr/samr.h" /* for struct samrPassword */ + #include "auth/credentials/credentials.h" + #include "auth/credentials/credentials_internal.h" ++#include "auth/gensec/gensec.h" + #include "libcli/auth/libcli_auth.h" + #include "tevent.h" + #include "param/param.h" +@@ -362,6 +363,8 @@ _PUBLIC_ bool cli_credentials_set_principal_callback(struct cli_credentials *cre + + _PUBLIC_ bool cli_credentials_authentication_requested(struct cli_credentials *cred) + { ++ uint32_t gensec_features = 0; ++ + if (cred->bind_dn) { + return true; + } +@@ -389,6 +392,19 @@ _PUBLIC_ bool cli_credentials_authentication_requested(struct cli_credentials *c + return true; + } + ++ gensec_features = cli_credentials_get_gensec_features(cred); ++ if (gensec_features & GENSEC_FEATURE_NTLM_CCACHE) { ++ return true; ++ } ++ ++ if (gensec_features & GENSEC_FEATURE_SIGN) { ++ return true; ++ } ++ ++ if (gensec_features & GENSEC_FEATURE_SEAL) { ++ return true; ++ } ++ + return false; + } + +-- +1.9.1 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-5.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-5.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-5.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-5.patch 2017-09-21 12:04:47.000000000 +0000 @@ -0,0 +1,45 @@ +From 4a91f4ab82e3f729a12947ff65a74b072dd94acc Mon Sep 17 00:00:00 2001 +From: Stefan Metzmacher +Date: Tue, 29 Aug 2017 15:35:49 +0200 +Subject: [PATCH] CVE-2017-12150: libcli/smb: add + smbXcli_conn_signing_mandatory() + +BUG: https://bugzilla.samba.org/show_bug.cgi?id=12997 + +Signed-off-by: Stefan Metzmacher +--- + libcli/smb/smbXcli_base.c | 5 +++++ + libcli/smb/smbXcli_base.h | 1 + + 2 files changed, 6 insertions(+) + +diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c +index 691b8ff..3c41127 100644 +--- a/libcli/smb/smbXcli_base.c ++++ b/libcli/smb/smbXcli_base.c +@@ -468,6 +468,11 @@ bool smbXcli_conn_use_unicode(struct smbXcli_conn *conn) + return false; + } + ++bool smbXcli_conn_signing_mandatory(struct smbXcli_conn *conn) ++{ ++ return conn->mandatory_signing; ++} ++ + void smbXcli_conn_set_sockopt(struct smbXcli_conn *conn, const char *options) + { + set_socket_options(conn->sock_fd, options); +diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h +index 16c8848..6809807 100644 +--- a/libcli/smb/smbXcli_base.h ++++ b/libcli/smb/smbXcli_base.h +@@ -47,6 +47,7 @@ bool smbXcli_conn_dfs_supported(struct smbXcli_conn *conn); + + enum protocol_types smbXcli_conn_protocol(struct smbXcli_conn *conn); + bool smbXcli_conn_use_unicode(struct smbXcli_conn *conn); ++bool smbXcli_conn_signing_mandatory(struct smbXcli_conn *conn); + + void smbXcli_conn_set_sockopt(struct smbXcli_conn *conn, const char *options); + const struct sockaddr_storage *smbXcli_conn_local_sockaddr(struct smbXcli_conn *conn); +-- +1.9.1 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-6.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-6.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-6.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12150-6.patch 2017-09-21 12:04:51.000000000 +0000 @@ -0,0 +1,32 @@ +From 81f1804d45c1b698ee87ee4d4c84197df98ea4f2 Mon Sep 17 00:00:00 2001 +From: Stefan Metzmacher +Date: Mon, 12 Dec 2016 06:07:56 +0100 +Subject: [PATCH] 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 + +Signed-off-by: Stefan Metzmacher +--- + source3/libsmb/clidfs.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c +index d2a4c19..3b3e6b9 100644 +--- a/source3/libsmb/clidfs.c ++++ b/source3/libsmb/clidfs.c +@@ -203,7 +203,9 @@ static NTSTATUS 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 || smbXcli_conn_signing_mandatory(c->conn) || + get_cmdline_auth_info_use_kerberos(auth_info) || ++ get_cmdline_auth_info_use_ccache(auth_info) || + !NT_STATUS_IS_OK(status = cli_session_setup(c, "", + "", 0, + "", 0, +-- +1.9.1 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12151-1.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12151-1.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12151-1.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12151-1.patch 2017-09-21 12:04:58.000000000 +0000 @@ -0,0 +1,56 @@ +From 17019aa27f612f4ccc7131d40c54b26864fef444 Mon Sep 17 00:00:00 2001 +From: Stefan Metzmacher +Date: Mon, 14 Aug 2017 12:13:18 +0200 +Subject: [PATCH] CVE-2017-12151: s3:libsmb: add cli_state_is_encryption_on() + helper function + +This allows to check if the current cli_state uses encryption +(either via unix extentions or via SMB3). + +BUG: https://bugzilla.samba.org/show_bug.cgi?id=12996 + +Signed-off-by: Stefan Metzmacher +--- + source3/libsmb/clientgen.c | 13 +++++++++++++ + source3/libsmb/proto.h | 1 + + 2 files changed, 14 insertions(+) + +diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c +index cfb3b16..868ee59 100644 +--- a/source3/libsmb/clientgen.c ++++ b/source3/libsmb/clientgen.c +@@ -339,6 +339,19 @@ uint16_t cli_getpid(struct cli_state *cli) + return cli->smb1.pid; + } + ++bool cli_state_is_encryption_on(struct cli_state *cli) ++{ ++ if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) { ++ return smb1cli_conn_encryption_on(cli->conn); ++ } ++ ++ if (cli->smb2.tcon == NULL) { ++ return false; ++ } ++ ++ return smb2cli_tcon_is_encryption_on(cli->smb2.tcon); ++} ++ + bool cli_state_has_tcon(struct cli_state *cli) + { + uint16_t tid = cli_state_get_tid(cli); +diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h +index dc9aa17..e872e31 100644 +--- a/source3/libsmb/proto.h ++++ b/source3/libsmb/proto.h +@@ -174,6 +174,7 @@ const char *cli_state_remote_realm(struct cli_state *cli); + uint16_t cli_state_get_vc_num(struct cli_state *cli); + uint16_t cli_setpid(struct cli_state *cli, uint16_t pid); + uint16_t cli_getpid(struct cli_state *cli); ++bool cli_state_is_encryption_on(struct cli_state *cli); + bool cli_state_has_tcon(struct cli_state *cli); + uint16_t cli_state_get_tid(struct cli_state *cli); + uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid); +-- +1.9.1 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12151-2.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12151-2.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12151-2.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12151-2.patch 2017-09-21 12:05:02.000000000 +0000 @@ -0,0 +1,54 @@ +From 50f649e7d0b27bcd7eaab7d8223ef9ccd99782dc Mon Sep 17 00:00:00 2001 +From: Stefan Metzmacher +Date: Sat, 17 Dec 2016 10:36:49 +0100 +Subject: [PATCH] CVE-2017-12151: s3:libsmb: make use of + cli_state_is_encryption_on() + +This will keep enforced encryption across dfs referrals. + +BUG: https://bugzilla.samba.org/show_bug.cgi?id=12996 + +Signed-off-by: Stefan Metzmacher +--- + source3/libsmb/clidfs.c | 4 ++-- + source3/libsmb/libsmb_context.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c +index 3b3e6b9..074f8ed 100644 +--- a/source3/libsmb/clidfs.c ++++ b/source3/libsmb/clidfs.c +@@ -954,7 +954,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx, + "IPC$", + dfs_auth_info, + false, +- smb1cli_conn_encryption_on(rootcli->conn), ++ cli_state_is_encryption_on(rootcli), + smbXcli_conn_protocol(rootcli->conn), + 0, + 0x20, +@@ -1012,7 +1012,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx, + dfs_refs[count].share, + dfs_auth_info, + false, +- smb1cli_conn_encryption_on(rootcli->conn), ++ cli_state_is_encryption_on(rootcli), + smbXcli_conn_protocol(rootcli->conn), + 0, + 0x20, +diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c +index 5e31dfb..0513374 100644 +--- a/source3/libsmb/libsmb_context.c ++++ b/source3/libsmb/libsmb_context.c +@@ -485,7 +485,7 @@ smbc_option_get(SMBCCTX *context, + + for (s = context->internal->servers; s; s = s->next) { + num_servers++; +- if (!smb1cli_conn_encryption_on(s->cli->conn)) { ++ if (!cli_state_is_encryption_on(s->cli)) { + return (void *)false; + } + } +-- +1.9.1 + diff -Nru samba-4.3.11+dfsg/debian/patches/CVE-2017-12163.patch samba-4.3.11+dfsg/debian/patches/CVE-2017-12163.patch --- samba-4.3.11+dfsg/debian/patches/CVE-2017-12163.patch 1970-01-01 00:00:00.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/CVE-2017-12163.patch 2017-09-21 12:05:07.000000000 +0000 @@ -0,0 +1,138 @@ +From bf85c3d4ed7a4f1a0be4e16faf5d9b562940d33d Mon Sep 17 00:00:00 2001 +From: Jeremy Allison +Date: Fri, 8 Sep 2017 10:13:14 -0700 +Subject: [PATCH] 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 + +Signed-off-by: Jeremy Allison +Signed-off-by: Stefan Metzmacher +--- + source3/smbd/reply.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 50 insertions(+) + +Index: samba-4.3.11+dfsg/source3/smbd/reply.c +=================================================================== +--- samba-4.3.11+dfsg.orig/source3/smbd/reply.c 2017-09-21 08:01:55.304101995 -0400 ++++ samba-4.3.11+dfsg/source3/smbd/reply.c 2017-09-21 08:01:55.300101947 -0400 +@@ -4313,6 +4313,9 @@ void reply_writebraw(struct smb_request + } + + /* 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); +@@ -4413,6 +4416,11 @@ void reply_writebraw(struct smb_request + 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); +@@ -4494,6 +4502,7 @@ void reply_writeunlock(struct smb_reques + connection_struct *conn = req->conn; + ssize_t nwritten = -1; + size_t numtowrite; ++ size_t remaining; + off_t startpos; + const char *data; + NTSTATUS status = NT_STATUS_OK; +@@ -4526,6 +4535,17 @@ void reply_writeunlock(struct smb_reques + 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, +@@ -4607,6 +4627,7 @@ void reply_write(struct smb_request *req + { + connection_struct *conn = req->conn; + size_t numtowrite; ++ size_t remaining; + ssize_t nwritten = -1; + off_t startpos; + const char *data; +@@ -4647,6 +4668,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, +@@ -4873,6 +4905,9 @@ void reply_write_and_X(struct smb_reques + goto out; + } + } 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); +@@ -5301,6 +5336,7 @@ void reply_writeclose(struct smb_request + { + connection_struct *conn = req->conn; + size_t numtowrite; ++ size_t remaining; + ssize_t nwritten = -1; + NTSTATUS close_status = NT_STATUS_OK; + off_t startpos; +@@ -5334,6 +5370,17 @@ void reply_writeclose(struct smb_request + 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 == NULL) { + init_strict_lock_struct(fsp, (uint64_t)req->smbpid, + (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, +@@ -5929,6 +5976,9 @@ void reply_printwrite(struct smb_request + + 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 -Nru samba-4.3.11+dfsg/debian/patches/series samba-4.3.11+dfsg/debian/patches/series --- samba-4.3.11+dfsg/debian/patches/series 2017-07-04 12:01:49.000000000 +0000 +++ samba-4.3.11+dfsg/debian/patches/series 2017-09-21 12:05:07.000000000 +0000 @@ -67,3 +67,14 @@ CVE-2017-7494.patch non-wide-symlinks-to-directories-12860.patch CVE-2017-9461.patch +CVE-2017-11103.patch +bug_1702529_EACCESS_with_rootshare.patch +CVE-2017-12150-1.patch +CVE-2017-12150-2.patch +CVE-2017-12150-3.patch +CVE-2017-12150-4.patch +CVE-2017-12150-5.patch +CVE-2017-12150-6.patch +CVE-2017-12151-1.patch +CVE-2017-12151-2.patch +CVE-2017-12163.patch