]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
CVE-2022-32744 s4:kdc: Don't allow HDB keytab iteration
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 24 May 2022 05:52:05 +0000 (17:52 +1200)
committerJule Anger <janger@samba.org>
Wed, 27 Jul 2022 10:52:36 +0000 (10:52 +0000)
A fallback in krb5_rd_req_ctx() means that Samba's kpasswd service will
try many inappropriate keys to decrypt the ticket supplied to it. For
example, it will accept a ticket encrypted with the Administrator's key,
when it should rather accept only tickets encrypted with the krbtgt's
key (and not an RODC krbtgt). To fix this, declare the HDB keytab using
the HDBGET ops, which do not support iteration.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
selftest/knownfail_heimdal_kdc
source4/kdc/kdc-heimdal.c

index 5321b109fc6fe5219482e15d1f4f1c8374b3d5d1..341cdfb21c11a6e94bf9891833e3798fa8907ef3 100644 (file)
@@ -57,7 +57,6 @@
 #
 # Kpasswd tests
 #
-^samba.tests.krb5.kpasswd_tests.samba.tests.krb5.kpasswd_tests.KpasswdTests.test_kpasswd_from_rodc.ad_dc
 ^samba.tests.krb5.kpasswd_tests.samba.tests.krb5.kpasswd_tests.KpasswdTests.test_kpasswd_wrong_key.ad_dc
 ^samba.tests.krb5.kpasswd_tests.samba.tests.krb5.kpasswd_tests.KpasswdTests.test_kpasswd_wrong_key_server.ad_dc
 ^samba.tests.krb5.kpasswd_tests.samba.tests.krb5.kpasswd_tests.KpasswdTests.test_kpasswd_wrong_key_service.ad_dc
index 0d2a410fc3b40160a3ddf4569ba981825e1bcb25..542986c5ad3d307ab3931a944af9c962d52e6a3d 100644 (file)
@@ -463,7 +463,7 @@ static void kdc_post_fork(struct task_server *task, struct process_details *pd)
                return;
        }
 
-       kdc->keytab_name = talloc_asprintf(kdc, "HDB:samba4:&%p", kdc->base_ctx);
+       kdc->keytab_name = talloc_asprintf(kdc, "HDBGET:samba4:&%p", kdc->base_ctx);
        if (kdc->keytab_name == NULL) {
                task_server_terminate(task,
                                      "kdc: Failed to set keytab name",
@@ -471,7 +471,7 @@ static void kdc_post_fork(struct task_server *task, struct process_details *pd)
                return;
        }
 
-       ret = krb5_kt_register(kdc->smb_krb5_context->krb5_context, &hdb_kt_ops);
+       ret = krb5_kt_register(kdc->smb_krb5_context->krb5_context, &hdb_get_kt_ops);
        if(ret) {
                task_server_terminate(task, "kdc: failed to register keytab plugin", true);
                return;