[Pkg-samba-maint] [samba] 02/04: s3: smbd: Fix SMB1 use-after-free crash bug. CVE-2017-14746

Mathieu Parent sathieu at moszumanska.debian.org
Tue Nov 21 09:48:52 UTC 2017


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

sathieu pushed a commit to annotated tag debian/2%4.7.1+dfsg-2
in repository samba.

commit 02eaa8dae0525966dffd223b7da6ec56bf06738c
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Sep 19 16:11:33 2017 -0700

    s3: smbd: Fix SMB1 use-after-free crash bug. CVE-2017-14746
    
    When setting up the chain, always use 'next->' variables
    not the 'req->' one.
    
    Bug discovered by 连一汉 <lianyihan at 360.cn>
    
    CVE-2017-14746
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13041
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
---
 source3/smbd/process.c | 7 ++++---
 source3/smbd/reply.c   | 5 +++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 3765739..3544266 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1855,12 +1855,13 @@ void smb_request_done(struct smb_request *req)
 
 		next->vuid = SVAL(req->outbuf, smb_uid);
 		next->tid  = SVAL(req->outbuf, smb_tid);
-		status = smb1srv_tcon_lookup(req->xconn, req->tid,
+		status = smb1srv_tcon_lookup(req->xconn, next->tid,
 					     now, &tcon);
+
 		if (NT_STATUS_IS_OK(status)) {
-			req->conn = tcon->compat;
+			next->conn = tcon->compat;
 		} else {
-			req->conn = NULL;
+			next->conn = NULL;
 		}
 		next->chain_fsp = req->chain_fsp;
 		next->inbuf = req->inbuf;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 7b07078..81acedf 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -923,6 +923,11 @@ void reply_tcon_and_X(struct smb_request *req)
 		}
 
 		TALLOC_FREE(tcon);
+		/*
+		 * This tree id is gone. Make sure we can't re-use it
+		 * by accident.
+		 */
+		req->tid = 0;
 	}
 
 	if ((passlen > MAX_PASS_LEN) || (passlen >= req->buflen)) {

-- 
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