From 5bba1a54fcea8dcf37932767ef726e32297bbf4b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Jan 2015 15:06:29 -0800 Subject: [PATCH 1/2] CVE-2015-0240: s3: netlogon: Ensure we don't call talloc_free on an uninitialized pointer. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11077 Signed-off-by: Jeremy Allison Reviewed-by: Stefan Metzmacher --- source3/rpc_server/srv_netlog_nt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index 972d902..07725d1 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -782,6 +782,10 @@ static NTSTATUS netr_creds_server_step_check(pipes_struct *p, (p->auth.auth_level == DCERPC_AUTH_LEVEL_INTEGRITY || p->auth.auth_level == DCERPC_AUTH_LEVEL_PRIVACY); */ + if (creds_out != NULL) { + *creds_out = NULL; + } + tdb = open_schannel_session_store(mem_ctx); if (!tdb) { return NT_STATUS_ACCESS_DENIED; @@ -923,7 +927,7 @@ NTSTATUS _netr_ServerPasswordSet(pipes_struct *p, NTSTATUS status = NT_STATUS_OK; struct samu *sampass=NULL; int i; - struct netlogon_creds_CredentialState *creds; + struct netlogon_creds_CredentialState *creds = NULL; DEBUG(5,("_netr_ServerPasswordSet: %d\n", __LINE__)); -- 2.3.0 From adff12eab06564d7e298735e6936058d173b678c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 16 Feb 2015 11:14:54 +0100 Subject: [PATCH 2/2] s3-netlogon: Make sure we do not deference a NULL pointer. This is an additional patch for CVE-2015-0240. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11077#c32 Pair-Programmed-With: Michael Adam Pair-Programmed-With: Andreas Schneider Signed-off-by: Michael Adam Signed-off-by: Andreas Schneider Reviewed-by: Volker Lendecke --- source3/rpc_server/srv_netlog_nt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index 07725d1..ebf974d 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -940,9 +940,15 @@ NTSTATUS _netr_ServerPasswordSet(pipes_struct *p, unbecome_root(); if (!NT_STATUS_IS_OK(status)) { + const char *computer_name = ""; + + if (creds != NULL && creds->computer_name != NULL) { + computer_name = creds->computer_name; + } + DEBUG(2,("_netr_ServerPasswordSet: netlogon_creds_server_step failed. Rejecting auth " "request from client %s machine account %s\n", - r->in.computer_name, creds->computer_name)); + r->in.computer_name, computer_name)); TALLOC_FREE(creds); return status; } -- 2.3.0