Avoid really, really huge cpu time usage caused by iteration count in
authorKen Raeburn <raeburn@mit.edu>
Sun, 13 Apr 2003 11:18:42 +0000 (11:18 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sun, 13 Apr 2003 11:18:42 +0000 (11:18 +0000)
spoofed preauth data.  (Merely huge cpu time usage is probably still
possible.)

* aes_s2k.c (krb5int_aes_string_to_key): Return an error if the supplied
iteration count is really, really large.

ticket: 1418
status: open

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15349 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/aes/ChangeLog
src/lib/crypto/aes/aes_s2k.c

index 443aabdd98d1ccb72aff75c1c5d9257d45b1a34c..3af490304959fbd5037d71faa4622e96d73a300f 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-13  Ken Raeburn  <raeburn@mit.edu>
+
+       * aes_s2k.c (krb5int_aes_string_to_key): Return an error if the
+       supplied iteration count is really, really large.
+
 2003-03-04  Ken Raeburn  <raeburn@mit.edu>
 
        * aes_s2k.c, aes_s2k.h: New files.
index f3670d7d84a087a65fa3b08e7337f6e15761acd0..6ea28690006c23dfb55cd2307763c868a5380d7f 100644 (file)
@@ -29,6 +29,12 @@ krb5int_aes_string_to_key(const struct krb5_enc_provider *enc,
     } else
        iter_count = 0xb000L;
 
+    /* This is not a protocol specification constraint; this is an
+       implementation limit, which should eventually be controlled by
+       a config file.  */
+    if (iter_count >= 0x1000000L)
+       return KRB5_ERR_BAD_S2K_PARAMS;
+
     /*
      * Dense key space, no parity bits or anything, so take a shortcut
      * and use the key contents buffer for the generated bytes.