[30126] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Fix read overflow in KDC sort_pa_data()

daemon@ATHENA.MIT.EDU (Greg Hudson)
Mon Mar 19 16:10:16 2018

Date: Mon, 19 Mar 2018 16:10:01 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201803192010.w2JKA18X011770@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/b38e318cea18fd65647189eed64aef83bf1cb772
commit b38e318cea18fd65647189eed64aef83bf1cb772
Author: Greg Hudson <ghudson@mit.edu>
Date:   Thu Mar 15 20:27:30 2018 -0400

    Fix read overflow in KDC sort_pa_data()
    
    sort_pa_data() could read past the end of pa_order if all preauth
    systems in the table have the PA_REPLACES_KEY flag, causing a
    dereference of preauth_systems[-1].  This situation became possible
    after commit fea1a488924faa3938ef723feaa1ff12d22a91ff with the
    elimination of static_preauth_systems; before that there were always
    table entries which did not have PA_REPLACES_KEY set.
    
    Fix this bug by removing the loop to count n_key_replacers, and
    instead get the count from the prior loop by stopping once we move all
    of the key-replacing modules to the front.

 src/kdc/kdc_preauth.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/kdc/kdc_preauth.c b/src/kdc/kdc_preauth.c
index 6f34dc2..fdf67d9 100644
--- a/src/kdc/kdc_preauth.c
+++ b/src/kdc/kdc_preauth.c
@@ -598,17 +598,18 @@ sort_pa_order(krb5_context context, krb5_kdc_req *request, int *pa_order)
                 break;
             }
         }
+        /* If we didn't find one, we have moved all of the key-replacing
+         * modules, and i is the count of those modules. */
+        if (j == n_repliers)
+            break;
     }
+    n_key_replacers = i;
 
     if (request->padata != NULL) {
         /* Now reorder the subset of modules which replace the key,
          * bubbling those which handle pa_data types provided by the
          * client ahead of the others.
          */
-        for (i = 0; preauth_systems[pa_order[i]].flags & PA_REPLACES_KEY; i++) {
-            continue;
-        }
-        n_key_replacers = i;
         for (i = 0; i < n_key_replacers; i++) {
             if (pa_list_includes(request->padata,
                                  preauth_systems[pa_order[i]].type))
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post