aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2016-07-19 11:00:28 -0400
committerTom Yu <tlyu@mit.edu>2016-07-19 18:05:20 -0400
commit85c3046d42eeb821967ad5625fcb08e8c6177b1a (patch)
tree6b40c72ef34f66b57c22f99a654a4ea728c7b871
parent857b82485a67094bbb2d73eb7572366878a4a9a9 (diff)
downloadkrb5-85c3046d42eeb821967ad5625fcb08e8c6177b1a.zip
krb5-85c3046d42eeb821967ad5625fcb08e8c6177b1a.tar.gz
krb5-85c3046d42eeb821967ad5625fcb08e8c6177b1a.tar.bz2
Fix S4U2Self KDC crash when anon is restricted
In validate_as_request(), when enforcing restrict_anonymous_to_tgt, use client.princ instead of request->client; the latter is NULL when validating S4U2Self requests. CVE-2016-3120: In MIT krb5 1.9 and later, an authenticated attacker can cause krb5kdc to dereference a null pointer if the restrict_anonymous_to_tgt option is set to true, by making an S4U2Self request. CVSSv2 Vector: AV:N/AC:H/Au:S/C:N/I:N/A:C/E:H/RL:OF/RC:C (cherry picked from commit 93b4a6306a0026cf1cc31ac4bd8a49ba5d034ba7) ticket: 8458 version_fixed: 1.14.3
-rw-r--r--src/kdc/kdc_util.c2
-rwxr-xr-xsrc/tests/t_pkinit.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/kdc/kdc_util.c b/src/kdc/kdc_util.c
index 776e130..29f9dbb 100644
--- a/src/kdc/kdc_util.c
+++ b/src/kdc/kdc_util.c
@@ -739,7 +739,7 @@ validate_as_request(kdc_realm_t *kdc_active_realm,
return(KDC_ERR_MUST_USE_USER2USER);
}
- if (check_anon(kdc_active_realm, request->client, request->server) != 0) {
+ if (check_anon(kdc_active_realm, client.princ, request->server) != 0) {
*status = "ANONYMOUS NOT ALLOWED";
return(KDC_ERR_POLICY);
}
diff --git a/src/tests/t_pkinit.py b/src/tests/t_pkinit.py
index b66c458..f0214b6 100755
--- a/src/tests/t_pkinit.py
+++ b/src/tests/t_pkinit.py
@@ -93,6 +93,11 @@ out = realm.run([kvno, realm.host_princ], expected_code=1)
if 'KDC policy rejects request' not in out:
fail('Wrong error for restricted anonymous PKINIT')
+# Regression test for #8458: S4U2Self requests crash the KDC if
+# anonymous is restricted.
+realm.kinit(realm.host_princ, flags=['-k'])
+realm.run([kvno, '-U', 'user', realm.host_princ])
+
# Go back to a normal KDC and disable anonymous PKINIT.
realm.stop_kdc()
realm.start_kdc()