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>
Tue, 6 Dec 2022 16:03:55 +0000 (16:03 +0000)
commit7bb1180c5adf98220962ee23938dc708ebd7bd02
tree8e2162fd099837d3b79c9ad939266f91edb56571
parent7b90f5c8296eeeeeebed5c2f969a96e78708d848
CVE-2022-44640 HEIMDAL: asn1: invalid free in ASN.1 codec

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.

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

(cherry-picked from Heimdal commit 9c9dac2b169255bad9071eea99fa90b980dde767)

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Dec  6 13:41:05 UTC 2022 on sn-devel-184

(cherry picked from commit 68fc909a7f4d69c254d34bec85cf8431bcb6e72f)

Autobuild-User(v4-17-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-17-test): Tue Dec  6 16:03:55 UTC 2022 on sn-devel-184
third_party/heimdal/lib/asn1/fuzz-inputs/KrbFastArmoredReq [new file with mode: 0644]
third_party/heimdal/lib/asn1/gen_decode.c
third_party/heimdal/lib/asn1/gen_free.c
third_party/heimdal/lib/asn1/gen_template.c
third_party/heimdal/lib/asn1/krb5.asn1