CVE-2022-37966 s4:kdc: announce PA-SUPPORTED-ETYPES like windows.
authorStefan Metzmacher <metze@samba.org>
Thu, 24 Mar 2022 14:44:40 +0000 (15:44 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 13 Dec 2022 23:48:49 +0000 (00:48 +0100)
commitee9ffe50e99d2778d0d17fb65d6b27911d211f91
treed015745c811bb516cf6708ac726331ea3a1de363
parent1815d339417261605820cb17f240c75fae01289a
CVE-2022-37966 s4:kdc: announce PA-SUPPORTED-ETYPES like windows.

We need to take the value from the msDS-SupportedEncryptionTypes
attribute and only take the default if there's no value or
if the value is 0.

For krbtgt and DC accounts we need to force support for
ARCFOUR-HMAC-MD5 and AES encryption types and add the related bits
in addtition. (Note for krbtgt msDS-SupportedEncryptionTypes is
completely ignored the hardcoded value is the default, so there's
no AES256-SK for krbtgt).

For UF_USE_DES_KEY_ONLY on the account we reset
the value to 0, these accounts are in fact disabled completely,
as they always result in KRB5KDC_ERR_ETYPE_NOSUPP.

Then we try to get all encryption keys marked in
supported_enctypes, and the available_enctypes
is a reduced set depending on what keys are
actually stored in the database.

We select the supported session key enctypes by the available
keys and in addition based on AES256-SK as well as the
"kdc force enable rc4 weak session keys" option.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit fde745ec3491a4fd7b23e053a67093a2ccaf0905)

[jsutton@samba.org Adapted to older KDC code]

[jsutton@samba.org Adapted to older KDC code]
selftest/knownfail.d/kdc-enctypes [deleted file]
selftest/knownfail_mit_kdc
source4/kdc/db-glue.c
source4/kdc/sdb.c
source4/kdc/sdb.h