Re: SMB3.11 security fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Proposed fix for the SMB3.11 (non-mandatory signing) case.

See MS-SMB2 3.2.4.1.1

On Sat, Mar 3, 2018 at 3:08 PM, Steve French <smfrench@xxxxxxxxx> wrote:
> SMB3.11 signing now works, thanks to Aurelien's patches (it had
> already worked as guest, but not as a regular user).
>
> It needs one minor fix (to send the signature on SMB3.11 tcon) to fix
> the non-signing case.  Am testing that now, but getting SMB3.11
> signing working is a big step and important for security.
>
> --
> Thanks,
>
> Steve



-- 
Thanks,

Steve
From 350477ecdbe087b790b86527db39b5e80a08c20e Mon Sep 17 00:00:00 2001
From: Steve French <sfrench@localhost.localdomain>
Date: Sat, 3 Mar 2018 16:08:45 -0600
Subject: [PATCH] [SMB3.11] Tree connect for SMB3.11 must be signed for
 non-guest users

SMB3.11 tree connect was only being signed when signing was mandatory
but needs to always be signed (for non-guest users).

See MS-SMB2 section 3.2.4.1.1

Signed-off-by: Steve French <smfrench@xxxxxxxxx>
CC: Stable <stable@xxxxxxxxxxxxxxx>
---
 fs/cifs/smb2pdu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 4b6920de2541..fe1d52c235ee 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1305,6 +1305,11 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 	iov[1].iov_base = unc_path;
 	iov[1].iov_len = unc_path_len;
 
+	/* 3.11 tcon req must be signed if not guest. See MS-SMB2 3.2.4.1.1 */
+	if ((ses->server->dialect == SMB311_PROT_ID) &&
+	    !(ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST))
+		req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
+
 	rc = smb2_send_recv(xid, ses, iov, 2, &resp_buftype, flags, &rsp_iov);
 	cifs_small_buf_release(req);
 	rsp = (struct smb2_tree_connect_rsp *)rsp_iov.iov_base;
-- 
2.14.3


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux