From 4653be2707491718be1242eb55176891c1553827 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Jan 2015 14:47:31 -0800 Subject: [PATCH 1/3] 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/netlogon/srv_netlog_nt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c index deba47b..34b9a02 100644 --- a/source3/rpc_server/netlogon/srv_netlog_nt.c +++ b/source3/rpc_server/netlogon/srv_netlog_nt.c @@ -1101,6 +1101,10 @@ static NTSTATUS netr_creds_server_step_check(struct pipes_struct *p, bool schannel_global_required = (lp_server_schannel() == true) ? true:false; struct loadparm_context *lp_ctx; + if (creds_out != NULL) { + *creds_out = NULL; + } + if (schannel_global_required) { status = schannel_check_required(&p->auth, computer_name, @@ -1258,7 +1262,7 @@ NTSTATUS _netr_ServerPasswordSet(struct pipes_struct *p, { NTSTATUS status = NT_STATUS_OK; int i; - struct netlogon_creds_CredentialState *creds; + struct netlogon_creds_CredentialState *creds = NULL; DEBUG(5,("_netr_ServerPasswordSet: %d\n", __LINE__)); -- 2.3.0 From afe56ec85e75209f18531925b08c0b86ee0c6f60 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 16 Feb 2015 10:59:23 +0100 Subject: [PATCH 2/3] 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/netlogon/srv_netlog_nt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c index 34b9a02..701d299 100644 --- a/source3/rpc_server/netlogon/srv_netlog_nt.c +++ b/source3/rpc_server/netlogon/srv_netlog_nt.c @@ -1275,9 +1275,14 @@ NTSTATUS _netr_ServerPasswordSet(struct 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 From 3c06608a23297e29fe1ba7841bd722992e20f4ac Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 16 Feb 2015 10:56:03 +0100 Subject: [PATCH 3/3] auth: Make sure that creds_out is initialized with NULL. 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 --- libcli/auth/schannel_state_tdb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcli/auth/schannel_state_tdb.c b/libcli/auth/schannel_state_tdb.c index 6abb69b..d8d5f84 100644 --- a/libcli/auth/schannel_state_tdb.c +++ b/libcli/auth/schannel_state_tdb.c @@ -286,6 +286,10 @@ NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, NTSTATUS status; int ret; + if (creds_out != NULL) { + *creds_out = NULL; + } + tmpctx = talloc_named(mem_ctx, 0, "schannel_check_creds_state"); if (!tmpctx) { return NT_STATUS_NO_MEMORY; -- 2.3.0