CVE-2022-44640 HEIMDAL: asn1: Invalid free in ASN.1 codec
authorNicolas Williams <nico@twosigma.com>
Wed, 10 Mar 2021 22:49:04 +0000 (16:49 -0600)
committerStefan Metzmacher <metze@samba.org>
Wed, 7 Dec 2022 18:33:51 +0000 (19:33 +0100)
commitb4c3ce6fb9b2aebbbe7d802ce48c691a9cabcf4f
tree7448243f5638528c0736ecdf326461b77716b7bc
parentf3672577a8e15b7937d0067a262d04df632dade9
CVE-2022-44640 HEIMDAL: asn1: Invalid free in ASN.1 codec

This is a 10.0 on the Common Vulnerability Scoring System (CVSS) v3.

Heimdal's ASN.1 compiler generates code that allows specially
crafted DER encodings of CHOICEs to invoke the wrong free function
on the decoded structure upon decode error.  This is known to impact
the Heimdal KDC, leading to an invalid free() of an address partly
or wholly under the control of the attacker, in turn leading to a
potential remote code execution (RCE) vulnerability.

This error affects the DER codec for all CHOICE types used in
Heimdal, though not all cases will be exploitable.  We have not
completed a thorough analysis of all the Heimdal components
affected, thus the Kerberos client, the X.509 library, and other
parts, may be affected as well.

This bug has been in Heimdal since 2005.  It was first reported by
Douglas Bagnall, though it had been found independently by the
Heimdal maintainers via fuzzing a few weeks earlier.

While no zero-day exploit is known, such an exploit will likely be
available soon after public disclosure.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14929

[abartlet@samba.org Adapted from Heimdal commit
ea5ec8f174920cb80ce2b168b49195378420449e for older Heimdal in Samba 4.15
by dropping fuzz-inputs file and EXPORTS entry for fuzzing]

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/heimdal/lib/asn1/gen_decode.c
source4/heimdal/lib/asn1/gen_free.c