CVE-2020-25719 kdc: Avoid races and multiple DB lookups in s4u2self check
authorAndrew Bartlett <abartlet@samba.org>
Thu, 7 Oct 2021 19:29:51 +0000 (08:29 +1300)
committerJule Anger <janger@samba.org>
Mon, 8 Nov 2021 09:52:12 +0000 (10:52 +0100)
commit8d94ec0d3f7d3271aa9499e6a9c535ba2efc8f57
tree6cd7d71f33534a4285da3e2bf645fc3701b73c4a
parentaa66df26021f6c305f932c8ca8d9a50066822fcd
CVE-2020-25719 kdc: Avoid races and multiple DB lookups in s4u2self check

Looking up the DB twice is subject to a race and is a poor
use of resources, so instead just pass in the record we
already got when trying to confirm that the server in
S4U2Self is the same as the requesting client.

The client record has already been bound to the the
original client by the SID check in the PAC.

Likewise by looking up server only once we ensure
that the keys looked up originally are in the record
we confirm the SID for here.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
source4/heimdal/kdc/krb5tgs.c
source4/heimdal/lib/hdb/hdb.h
source4/kdc/db-glue.c
source4/kdc/db-glue.h
source4/kdc/hdb-samba4.c