Skip to content

Commit

Permalink
set sshpam_ctxt to NULL after free
Browse files Browse the repository at this point in the history
Avoids use-after-free in monitor when privsep child is compromised.
Reported by Moritz Jodeit; ok dtucker@
  • Loading branch information
djmdjm committed Aug 11, 2015
1 parent d4697fe commit 5e75f51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion monitor.c
Expand Up @@ -1166,14 +1166,16 @@ mm_answer_pam_respond(int sock, Buffer *m)
int
mm_answer_pam_free_ctx(int sock, Buffer *m)
{
int r = sshpam_authok != NULL && sshpam_authok == sshpam_ctxt;

debug3("%s", __func__);
(sshpam_device.free_ctx)(sshpam_ctxt);
sshpam_ctxt = sshpam_authok = NULL;
buffer_clear(m);
mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m);
auth_method = "keyboard-interactive";
auth_submethod = "pam";
return (sshpam_authok == sshpam_ctxt);
return r;
}
#endif

Expand Down

0 comments on commit 5e75f51

Please sign in to comment.