From nobody Sat Nov 26 11:27:56 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NK8bx3XmNz4jBd4 for ; Sat, 26 Nov 2022 11:27:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NK8bx0tzNz3K5m for ; Sat, 26 Nov 2022 11:27:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669462077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0faaBk6CHV22EvypZGgDEUljvrwUM1fK1Pb1CvFy9r4=; b=OfDkLHFNc+7GeR+6BLGpgkdlilyEgfbLwUQhzjnBGe7eCiXNbHbZrSSyA/LQBmf7kswKEg DtTztp4L/m5ofsAsUGq0X25kEpqmiqH38NWpFslkv/2v+VjQYOW4Rc0x+DvvxHce1lEJA9 6DEuwjmCldF7gYdNyhb2oWot3rlsliNPjMPHYyXFJFBKWtiTXguCECSn+9NoIuraEJUXCv PWMrn9ELF2xHH/DR7JhTWdRM1Vrv/DzBQGZDq6eP8A7sdOK1xcz0K+l8QUWrip100SQ66e EAAKRuP1UOaQZg67bNJdUiqEsFNerJZxNiXxyREGmTo4rqg/2BleFx9wRufD9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669462077; a=rsa-sha256; cv=none; b=JbxtiVyAOWmE9V80CJjBd8deiZb+sEQJkf1UkfBLXtT8XQH6vBr5rpQ4I4ljmyfwbbGVUA RO29k0APhW+IRt+n9i+hkAmB0yPImfwZVMaESrPv+poEZFLVSe4sVM4XnAojGfDGk0Hwzp YAdVDNlTQ7swpQMVSPZX5stIL0qEn4+0VQILyHHdaYXEJ2ADqdIInHlBtMve9l7EBrJ9a0 BMzi40GlLeooBvUgD1AaUTGNVPmXXz95vXTaBaQIV4tlBk3h0uUCfFCdsbVwHMCdqUjzd0 O2j4MlES61CBYK0tBh30WEq3q7p/lnucMEqfI7920J82fQYxgMPpIN9eXie7Dw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NK8bw6ydbzHfr for ; Sat, 26 Nov 2022 11:27:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2AQBRuRD068456 for ; Sat, 26 Nov 2022 11:27:56 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2AQBRuwK068455 for bugs@FreeBSD.org; Sat, 26 Nov 2022 11:27:56 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268002] kadmind kadm_chpass_with_key crash if client sends bogus KRB5_NT_ENTERPRISE_PRINCIPAL Date: Sat, 26 Nov 2022 11:27:56 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268002 Bug ID: 268002 Summary: kadmind kadm_chpass_with_key crash if client sends bogus KRB5_NT_ENTERPRISE_PRINCIPAL Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Attachment #238353 text/plain mime type: Created attachment 238353 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D238353&action= =3Dedit crash kadmind with a malformed principal _hdb_fetch_kvno() returns error KRB5_PARSE_MALFORMED if the client sends kadmind a kadm_chpass_with_key request with a principal type of KRB5_NT_ENTERPRISE_PRINCIPAL but otherwise malformed: if (principal->name.name_type =3D=3D KRB5_NT_ENTERPRISE_PRINCIPAL) { if (principal->name.name_string.len !=3D 1) { ret =3D KRB5_PARSE_MALFORMED; kadm5_s_chpass_principal_with_key() ignores that error, leaving a NULL ent.entry.principal: ret =3D context->db->hdb_fetch_kvno(context->context, context->db, prin= c, 0, HDB_F_GET_ANY|HDB_F_ADMIN_DATA, &ent); if(ret =3D=3D HDB_ERR_NOENTRY) goto out; Later, _hdb_store() &c try to use that NULL principal and crash. I've attached a demo. It requires the user to have run kinit, and to have "all" permissions in /var/heimdal/kadmind.acl. # cc kadmind17b.c -lkrb5 # ./a.out #0 copy_NAME_TYPE (from=3D0x0, to=3D0x7be685f78) at asn1_krb5_asn1.c:98 #1 0x00000007c593a638 in copy_PrincipalName (from=3D0x0, to=3D0x7be685f78) at asn1_krb5_asn1.c:1007 #2 0x00000007c593aa42 in copy_Principal (from=3D0x0, to=3D0x7be685f78) at asn1_krb5_asn1.c:1152 #3 0x00000007c1f82a86 in hdb_principal2key (context=3D0x7cd4bee10, p=3D0x0= ,=20 key=3D0x7be685fd0) at /usr/rtm/symbsd/src/crypto/heimdal/lib/hdb/common= .c:43 #4 0x00000007c1f82f28 in _hdb_store (context=3D0x7cd4bee10, db=3D0x7cd504a= b0,=20 flags=3D2, entry=3D0x7be686028) at /usr/rtm/symbsd/src/crypto/heimdal/lib/hdb/common.c:310 #5 0x00000007c03b6208 in kadm5_s_chpass_principal_with_key ( server_handle=3D0x7cd5044c0, princ=3D, n_key_data=3D0,=20 key_data=3D0x7cd515ef0) at /usr/rtm/symbsd/src/crypto/heimdal/lib/kadm5/chpass_s.c:188 #6 0x00000007c03b627e in kadm5_chpass_principal_with_key (server_handle=3D= 0x0,=20 princ=3D0x7be685f78, n_key_data=3D0, key_data=3D0xfe7c1e8a54748e96) at /usr/rtm/symbsd/src/crypto/heimdal/lib/kadm5/common_glue.c:54 #7 0x000000073db669b0 in kadmind_dispatch (kadm_handlep=3D0x7cd5044c0,=20 initial=3D, in=3D, out=3D0x7be6862f8) at /usr/rtm/symbsd/src/crypto/heimdal/kadmin/server.c:324 #8 0x000000073db65f9e in v5_loop (contextp=3D, --=20 You are receiving this mail because: You are the assignee for the bug.=