krb5 commit [krb5-1.22]: Prevent integer overrun in keytab parsing
ghudson at mit.edu
ghudson at mit.edu
Mon Aug 31 22:48:25 EDT 2026
https://github.com/krb5/krb5/commit/8eab516421b6b1fee2482194cd4bedcfc552bfeb
commit 8eab516421b6b1fee2482194cd4bedcfc552bfeb
Author: Greg Hudson <ghudson at mit.edu>
Date: Sat Jul 11 19:43:08 2026 -0400
Prevent integer overrun in keytab parsing
In krb5_ktfileint_internal_read_entry(), once we have read the size
and determined the starting point of a keytab record, bounds-check the
size to prevent an integer overflow when we seek to the next record.
(Discovered by OSS-Fuzz.)
(cherry picked from commit c5629fdffee70a296429d580a890e21c6fa17665)
ticket: 9224
version_fixed: 1.22.3
src/lib/krb5/keytab/kt_file.c | 2 ++
src/tests/fuzzing/fuzz_keytab_seed_corpus/big_size | Bin 0 -> 28 bytes
2 files changed, 2 insertions(+)
diff --git a/src/lib/krb5/keytab/kt_file.c b/src/lib/krb5/keytab/kt_file.c
index 993f902c7..ff9fa2309 100644
--- a/src/lib/krb5/keytab/kt_file.c
+++ b/src/lib/krb5/keytab/kt_file.c
@@ -935,6 +935,8 @@ krb5_ktfileint_internal_read_entry(krb5_context context, krb5_keytab id, krb5_ke
}
start_pos = ftell(KTFILEP(id));
+ if (size > INT32_MAX - start_pos)
+ return KRB5_KT_FORMAT;
/* deal with guts of parsing... */
diff --git a/src/tests/fuzzing/fuzz_keytab_seed_corpus/big_size b/src/tests/fuzzing/fuzz_keytab_seed_corpus/big_size
new file mode 100644
index 000000000..7a1e6c2c5
Binary files /dev/null and b/src/tests/fuzzing/fuzz_keytab_seed_corpus/big_size differ
More information about the cvs-krb5
mailing list