Package: krb5 / 1.12.1+dfsg-19+deb8u4

prevent-requires_preauth-bypass-cve-2015.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From: Greg Hudson <ghudson@mit.edu>
Date: Tue, 24 Mar 2015 12:02:37 -0400
X-Dgit-Generated: 1.12.1+dfsg-19+deb8u3 666b6ee77073326e44625c3e24a5710ebef5ad56
Subject: Prevent requires_preauth bypass [CVE-2015-2694]

In the OTP kdcpreauth module, don't set the TKT_FLG_PRE_AUTH bit until
the request is successfully verified.  In the PKINIT kdcpreauth
module, don't respond with code 0 on empty input or an unconfigured
realm.  Together these bugs could cause the KDC preauth framework to
erroneously treat a request as pre-authenticated.

CVE-2015-2694:

In MIT krb5 1.12 and later, when the KDC is configured with PKINIT
support, an unauthenticated remote attacker can bypass the
requires_preauth flag on a client principal and obtain a ciphertext
encrypted in the principal's long-term key.  This ciphertext could be
used to conduct an off-line dictionary attack against the user's
password.

    CVSSv2 Vector: AV:N/AC:M/Au:N/C:P/I:P/A:N/E:POC/RL:OF/RC:C

(cherry picked from commit e3b5a5e5267818c97750b266df50b6a3d4649604)

ticket: 8160
version_fixed: 1.13.2
status: resolved

(cherry picked from commit df8afc60d970a7176a55ffe7ce21cfd57ba423cd)
patch-category: upstream
(cherry picked from commit 8159057a3dfa382ffd6c1cceaab436011e92f435)

---

--- krb5-1.12.1+dfsg.orig/src/plugins/preauth/otp/main.c
+++ krb5-1.12.1+dfsg/src/plugins/preauth/otp/main.c
@@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list
 struct request_state {
     krb5_kdcpreauth_verify_respond_fn respond;
     void *arg;
+    krb5_enc_tkt_part *enc_tkt_reply;
 };
 
 static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code
     if (retval == 0 && response != otp_response_success)
         retval = KRB5_PREAUTH_FAILED;
 
+    if (retval == 0)
+        rs.enc_tkt_reply->flags |= TKT_FLG_PRE_AUTH;
+
     rs.respond(rs.arg, retval, NULL, NULL, NULL);
 }
 
@@ -263,8 +267,6 @@ otp_verify(krb5_context context, krb5_da
     krb5_data d, plaintext;
     char *config;
 
-    enc_tkt_reply->flags |= TKT_FLG_PRE_AUTH;
-
     /* Get the FAST armor key. */
     armor_key = cb->fast_armor(context, rock);
     if (armor_key == NULL) {
@@ -298,12 +300,14 @@ otp_verify(krb5_context context, krb5_da
         goto error;
     }
 
-    /* Create the request state. */
+    /* Create the request state.  Save the response callback, and the
+     * enc_tkt_reply pointer so we can set the TKT_FLG_PRE_AUTH flag later. */
     rs = k5alloc(sizeof(struct request_state), &retval);
     if (rs == NULL)
         goto error;
     rs->arg = arg;
     rs->respond = respond;
+    rs->enc_tkt_reply = enc_tkt_reply;
 
     /* Get the principal's OTP configuration string. */
     retval = cb->get_string(context, rock, "otp", &config);
--- krb5-1.12.1+dfsg.orig/src/plugins/preauth/pkinit/pkinit_srv.c
+++ krb5-1.12.1+dfsg/src/plugins/preauth/pkinit/pkinit_srv.c
@@ -306,7 +306,7 @@ pkinit_server_verify_padata(krb5_context
 
     pkiDebug("pkinit_verify_padata: entered!\n");
     if (data == NULL || data->length <= 0 || data->contents == NULL) {
-        (*respond)(arg, 0, NULL, NULL, NULL);
+        (*respond)(arg, EINVAL, NULL, NULL, NULL);
         return;
     }
 
@@ -318,7 +318,7 @@ pkinit_server_verify_padata(krb5_context
 
     plgctx = pkinit_find_realm_context(context, moddata, request->server);
     if (plgctx == NULL) {
-        (*respond)(arg, 0, NULL, NULL, NULL);
+        (*respond)(arg, EINVAL, NULL, NULL, NULL);
         return;
     }