From f70da8a04ce4f3c8c591e73dcbe980353dc0e3b4 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 13 Jul 2017 11:03:57 +0200 Subject: [PATCH] Increase salt length for salt of generic hash types Remove --hex-salt support for non-generic hash types --- include/common.h | 4 ++ include/interface.h | 90 ++++++++++------------------ include/types.h | 7 +++ src/interface.c | 142 ++++++++++++++------------------------------ 4 files changed, 90 insertions(+), 153 deletions(-) diff --git a/include/common.h b/include/common.h index 4babea668..fa0243f48 100644 --- a/include/common.h +++ b/include/common.h @@ -82,6 +82,10 @@ but this is nededed for VS compiler which doesn't have inline keyword but has __ #define PW_MAX 256 #define PW_MAX_OLD 55 +#define SALT_MIN 0 +#define SALT_MAX 256 +#define SALT_MAX_OLD 51 + #define HCBUFSIZ_TINY 0x1000 #define HCBUFSIZ_LARGE 0x50000 diff --git a/include/interface.h b/include/interface.h index 977b1188b..3fead7a35 100644 --- a/include/interface.h +++ b/include/interface.h @@ -965,31 +965,31 @@ typedef enum display_len DISPLAY_LEN_MIN_0 = 32, DISPLAY_LEN_MAX_0 = 32, DISPLAY_LEN_MIN_10 = 32 + 1 + 0, - DISPLAY_LEN_MAX_10 = 32 + 1 + 51, + DISPLAY_LEN_MAX_10 = 32 + 1 + SALT_MAX, DISPLAY_LEN_MIN_10H = 32 + 1 + 0, - DISPLAY_LEN_MAX_10H = 32 + 1 + 102, + DISPLAY_LEN_MAX_10H = 32 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_20 = 32 + 1 + 0, - DISPLAY_LEN_MAX_20 = 32 + 1 + 31, + DISPLAY_LEN_MAX_20 = 32 + 1 + SALT_MAX, DISPLAY_LEN_MIN_20H = 32 + 1 + 0, - DISPLAY_LEN_MAX_20H = 32 + 1 + 62, + DISPLAY_LEN_MAX_20H = 32 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_50 = 32 + 1 + 0, - DISPLAY_LEN_MAX_50 = 32 + 1 + 51, + DISPLAY_LEN_MAX_50 = 32 + 1 + SALT_MAX, DISPLAY_LEN_MIN_50H = 32 + 1 + 0, - DISPLAY_LEN_MAX_50H = 32 + 1 + 102, + DISPLAY_LEN_MAX_50H = 32 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_100 = 40, DISPLAY_LEN_MAX_100 = 40, DISPLAY_LEN_MIN_110 = 40 + 1 + 0, - DISPLAY_LEN_MAX_110 = 40 + 1 + 51, + DISPLAY_LEN_MAX_110 = 40 + 1 + SALT_MAX, DISPLAY_LEN_MIN_110H = 40 + 1 + 0, - DISPLAY_LEN_MAX_110H = 40 + 1 + 102, + DISPLAY_LEN_MAX_110H = 40 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_120 = 40 + 1 + 0, - DISPLAY_LEN_MAX_120 = 40 + 1 + 31, + DISPLAY_LEN_MAX_120 = 40 + 1 + SALT_MAX, DISPLAY_LEN_MIN_120H = 40 + 1 + 0, - DISPLAY_LEN_MAX_120H = 40 + 1 + 62, + DISPLAY_LEN_MAX_120H = 40 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_150 = 40 + 1 + 0, - DISPLAY_LEN_MAX_150 = 40 + 1 + 51, + DISPLAY_LEN_MAX_150 = 40 + 1 + SALT_MAX, DISPLAY_LEN_MIN_150H = 40 + 1 + 0, - DISPLAY_LEN_MAX_150H = 40 + 1 + 102, + DISPLAY_LEN_MAX_150H = 40 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_200 = 16, DISPLAY_LEN_MAX_200 = 16, DISPLAY_LEN_MIN_300 = 40, @@ -1005,33 +1005,31 @@ typedef enum display_len DISPLAY_LEN_MIN_900 = 32, DISPLAY_LEN_MAX_900 = 32, DISPLAY_LEN_MIN_910 = 32 + 1 + 0, - DISPLAY_LEN_MAX_910 = 32 + 1 + 51, + DISPLAY_LEN_MAX_910 = 32 + 1 + SALT_MAX, DISPLAY_LEN_MIN_910H = 32 + 1 + 0, - DISPLAY_LEN_MAX_910H = 32 + 1 + 102, + DISPLAY_LEN_MAX_910H = 32 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_1000 = 32, DISPLAY_LEN_MAX_1000 = 32, DISPLAY_LEN_MIN_1100 = 32 + 1 + 0, - DISPLAY_LEN_MAX_1100 = 32 + 1 + 19, - DISPLAY_LEN_MIN_1100H = 32 + 1 + 0, - DISPLAY_LEN_MAX_1100H = 32 + 1 + 38, + DISPLAY_LEN_MAX_1100 = 32 + 1 + SALT_MAX, DISPLAY_LEN_MIN_1300 = 56, DISPLAY_LEN_MAX_1300 = 56, DISPLAY_LEN_MIN_1400 = 64, DISPLAY_LEN_MAX_1400 = 64, DISPLAY_LEN_MIN_1410 = 64 + 1 + 0, - DISPLAY_LEN_MAX_1410 = 64 + 1 + 51, + DISPLAY_LEN_MAX_1410 = 64 + 1 + SALT_MAX, DISPLAY_LEN_MIN_1410H = 64 + 1 + 0, - DISPLAY_LEN_MAX_1410H = 64 + 1 + 102, + DISPLAY_LEN_MAX_1410H = 64 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_1420 = 64 + 1 + 0, - DISPLAY_LEN_MAX_1420 = 64 + 1 + 16, + DISPLAY_LEN_MAX_1420 = 64 + 1 + SALT_MAX, DISPLAY_LEN_MIN_1420H = 64 + 1 + 0, - DISPLAY_LEN_MAX_1420H = 64 + 1 + 32, + DISPLAY_LEN_MAX_1420H = 64 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_1421 = 70, DISPLAY_LEN_MAX_1421 = 70, DISPLAY_LEN_MIN_1450 = 64 + 1 + 0, - DISPLAY_LEN_MAX_1450 = 64 + 1 + 51, + DISPLAY_LEN_MAX_1450 = 64 + 1 + SALT_MAX, DISPLAY_LEN_MIN_1450H = 64 + 1 + 0, - DISPLAY_LEN_MAX_1450H = 64 + 1 + 102, + DISPLAY_LEN_MAX_1450H = 64 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_1500 = 13, DISPLAY_LEN_MAX_1500 = 13, DISPLAY_LEN_MIN_1600 = 29 + 0, @@ -1039,43 +1037,35 @@ typedef enum display_len DISPLAY_LEN_MIN_1700 = 128, DISPLAY_LEN_MAX_1700 = 128, DISPLAY_LEN_MIN_1710 = 128 + 1 + 0, - DISPLAY_LEN_MAX_1710 = 128 + 1 + 51, + DISPLAY_LEN_MAX_1710 = 128 + 1 + SALT_MAX, DISPLAY_LEN_MIN_1710H = 128 + 1 + 0, - DISPLAY_LEN_MAX_1710H = 128 + 1 + 102, + DISPLAY_LEN_MAX_1710H = 128 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_1720 = 128 + 1 + 0, - DISPLAY_LEN_MAX_1720 = 128 + 1 + 16, + DISPLAY_LEN_MAX_1720 = 128 + 1 + SALT_MAX, DISPLAY_LEN_MIN_1720H = 128 + 1 + 0, - DISPLAY_LEN_MAX_1720H = 128 + 1 + 32, + DISPLAY_LEN_MAX_1720H = 128 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_1730 = 128 + 1 + 0, - DISPLAY_LEN_MAX_1730 = 128 + 1 + 16, - DISPLAY_LEN_MIN_1731 = 128 + 6 + 0, - DISPLAY_LEN_MAX_1731 = 128 + 6 + 16, + DISPLAY_LEN_MAX_1730 = 128 + 1 + SALT_MAX, DISPLAY_LEN_MIN_1740 = 128 + 1 + 0, - DISPLAY_LEN_MAX_1740 = 128 + 1 + 16, + DISPLAY_LEN_MAX_1740 = 128 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_1750 = 128 + 1 + 0, - DISPLAY_LEN_MAX_1750 = 128 + 1 + 51, + DISPLAY_LEN_MAX_1750 = 128 + 1 + SALT_MAX, DISPLAY_LEN_MIN_1750H = 128 + 1 + 0, - DISPLAY_LEN_MAX_1750H = 128 + 1 + 102, + DISPLAY_LEN_MAX_1750H = 128 + 1 + (SALT_MAX * 2), DISPLAY_LEN_MIN_1800 = 90 + 0, DISPLAY_LEN_MAX_1800 = 90 + 16, - DISPLAY_LEN_MIN_2100 = 6 + 1 + 1 + 1 + 1 + 32, - DISPLAY_LEN_MAX_2100 = 6 + 5 + 1 + 256 + 1 + 32, - DISPLAY_LEN_MIN_2100H = 6 + 1 + 1 + 2 + 1 + 32, - DISPLAY_LEN_MAX_2100H = 6 + 5 + 1 + 512 + 1 + 32, + DISPLAY_LEN_MIN_2100 = 6 + 1 + 1 + 0 + 1 + 32, + DISPLAY_LEN_MAX_2100 = 6 + 5 + 1 + SALT_MAX + 1 + 32, DISPLAY_LEN_MIN_2400 = 16, DISPLAY_LEN_MAX_2400 = 16, DISPLAY_LEN_MIN_2410 = 16 + 1 + 0, DISPLAY_LEN_MAX_2410 = 16 + 1 + 16, - DISPLAY_LEN_MIN_2410H = 16 + 1 + 0, - DISPLAY_LEN_MAX_2410H = 16 + 1 + 32, DISPLAY_LEN_MIN_2600 = 32, DISPLAY_LEN_MAX_2600 = 32, DISPLAY_LEN_MIN_3000 = 16, DISPLAY_LEN_MAX_3000 = 16, DISPLAY_LEN_MIN_3100 = 16 + 1 + 0, DISPLAY_LEN_MAX_3100 = 16 + 1 + 30, - DISPLAY_LEN_MIN_3100H = 16 + 1 + 0, - DISPLAY_LEN_MAX_3100H = 16 + 1 + 60, DISPLAY_LEN_MIN_3200 = 60, DISPLAY_LEN_MAX_3200 = 60, DISPLAY_LEN_MIN_4300 = 32, @@ -1293,20 +1283,12 @@ typedef enum display_len DISPLAY_LEN_MIN_11 = 32 + 1 + 16, DISPLAY_LEN_MAX_11 = 32 + 1 + 32, - DISPLAY_LEN_MIN_11H = 32 + 1 + 32, - DISPLAY_LEN_MAX_11H = 32 + 1 + 64, DISPLAY_LEN_MIN_12 = 32 + 1 + 1, DISPLAY_LEN_MAX_12 = 32 + 1 + 32, - DISPLAY_LEN_MIN_12H = 32 + 1 + 2, - DISPLAY_LEN_MAX_12H = 32 + 1 + 64, DISPLAY_LEN_MIN_21 = 32 + 1 + 1, DISPLAY_LEN_MAX_21 = 32 + 1 + 15, - DISPLAY_LEN_MIN_21H = 32 + 1 + 2, - DISPLAY_LEN_MAX_21H = 32 + 1 + 30, DISPLAY_LEN_MIN_22 = 30 + 1 + 1, DISPLAY_LEN_MAX_22 = 30 + 1 + 28, - DISPLAY_LEN_MIN_22H = 30 + 1 + 2, - DISPLAY_LEN_MAX_22H = 30 + 1 + 56, DISPLAY_LEN_MIN_23 = 32 + 1 + 0, DISPLAY_LEN_MAX_23 = 32 + 1 + 23, DISPLAY_LEN_MIN_101 = 5 + 28, @@ -1317,8 +1299,6 @@ typedef enum display_len DISPLAY_LEN_MAX_112 = 40 + 1 + 20, DISPLAY_LEN_MIN_121 = 40 + 1 + 1, DISPLAY_LEN_MAX_121 = 40 + 1 + 32, - DISPLAY_LEN_MIN_121H = 40 + 1 + 2, - DISPLAY_LEN_MAX_121H = 40 + 1 + 64, DISPLAY_LEN_MIN_122 = 8 + 40, DISPLAY_LEN_MAX_122 = 8 + 40, DISPLAY_LEN_MIN_124 = 4 + 1 + 0 + 1 + 40, @@ -1341,20 +1321,16 @@ typedef enum display_len DISPLAY_LEN_MAX_1711 = 9 + 86 + 68, DISPLAY_LEN_MIN_1722 = 8 + 128, DISPLAY_LEN_MAX_1722 = 8 + 128, + DISPLAY_LEN_MIN_1731 = 128 + 6 + 0, + DISPLAY_LEN_MAX_1731 = 128 + 6 + 16, DISPLAY_LEN_MIN_2611 = 32 + 1 + 0, DISPLAY_LEN_MAX_2611 = 32 + 1 + 23, - DISPLAY_LEN_MIN_2611H = 32 + 1 + 0, DISPLAY_LEN_MIN_2612 = 6 + 0 + 1 + 32, - DISPLAY_LEN_MAX_2611H = 32 + 1 + 46, DISPLAY_LEN_MAX_2612 = 6 + 46 + 1 + 32, DISPLAY_LEN_MIN_2711 = 32 + 1 + 23, DISPLAY_LEN_MAX_2711 = 32 + 1 + 31, - DISPLAY_LEN_MIN_2711H = 32 + 1 + 46, - DISPLAY_LEN_MAX_2711H = 32 + 1 + 62, DISPLAY_LEN_MIN_2811 = 32 + 1 + 0, DISPLAY_LEN_MAX_2811 = 32 + 1 + 31, - DISPLAY_LEN_MIN_2811H = 32 + 1 + 0, - DISPLAY_LEN_MAX_2811H = 32 + 1 + 62, DISPLAY_LEN_MIN_3711 = 3 + 0 + 1 + 32, DISPLAY_LEN_MAX_3711 = 3 + 31 + 1 + 32, DISPLAY_LEN_MIN_4521 = 40 + 1 + 32, diff --git a/include/types.h b/include/types.h index f51c18830..4c2c9124d 100644 --- a/include/types.h +++ b/include/types.h @@ -832,9 +832,16 @@ struct hashconfig u32 tmp_size; u32 hook_size; + // password length limit + u32 pw_min; u32 pw_max; + // salt length limit (generic hashes) + + u32 salt_min; + u32 salt_max; + int (*parse_func) (u8 *, u32, hash_t *, const struct hashconfig *); char *st_hash; diff --git a/src/interface.c b/src/interface.c index d8e100eac..c78df37a3 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2420,6 +2420,17 @@ static void drupal7_encode (u8 digest[64], u8 buf[43]) static u32 parse_and_store_salt (u8 *out, u8 *in, u32 salt_len, MAYBE_UNUSED const hashconfig_t *hashconfig) { + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + if (salt_len < (hashconfig->salt_min * 2)) return UINT_MAX; + if (salt_len > (hashconfig->salt_max * 2)) return UINT_MAX; + } + else + { + if (salt_len < hashconfig->salt_min) return UINT_MAX; + if (salt_len > hashconfig->salt_max) return UINT_MAX; + } + u32 tmp_u32[(64 * 2) + 1] = { 0 }; u8 *tmp = (u8 *) tmp_u32; @@ -2823,14 +2834,7 @@ int osx512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU int osc_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_21H) || (input_len > DISPLAY_LEN_MAX_21H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_21) || (input_len > DISPLAY_LEN_MAX_21)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_21) || (input_len > DISPLAY_LEN_MAX_21)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -2870,14 +2874,7 @@ int osc_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED int netscreen_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_22H) || (input_len > DISPLAY_LEN_MAX_22H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_22) || (input_len > DISPLAY_LEN_MAX_22)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_22) || (input_len > DISPLAY_LEN_MAX_22)) return (PARSER_GLOBAL_LENGTH); // unscramble @@ -2989,14 +2986,7 @@ int netscreen_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_ int smf_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_121H) || (input_len > DISPLAY_LEN_MAX_121H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_121) || (input_len > DISPLAY_LEN_MAX_121)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_121) || (input_len > DISPLAY_LEN_MAX_121)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -3044,14 +3034,7 @@ int smf_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED int dcc2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_2100H) || (input_len > DISPLAY_LEN_MAX_2100H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_2100) || (input_len > DISPLAY_LEN_MAX_2100)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_2100) || (input_len > DISPLAY_LEN_MAX_2100)) return (PARSER_GLOBAL_LENGTH); if (memcmp (SIGNATURE_DCC2, input_buf, 6)) return (PARSER_SIGNATURE_UNMATCHED); @@ -3965,14 +3948,7 @@ int md5pix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU int md5asa_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_2410H) || (input_len > DISPLAY_LEN_MAX_2410H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_2410) || (input_len > DISPLAY_LEN_MAX_2410)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_2410) || (input_len > DISPLAY_LEN_MAX_2410)) return (PARSER_GLOBAL_LENGTH); int *digest = (int *) hash_buf->digest; @@ -4453,14 +4429,7 @@ int netntlmv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_ int joomla_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_11H) || (input_len > DISPLAY_LEN_MAX_11H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_11) || (input_len > DISPLAY_LEN_MAX_11)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_11) || (input_len > DISPLAY_LEN_MAX_11)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -4500,14 +4469,7 @@ int joomla_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU int postgresql_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_12H) || (input_len > DISPLAY_LEN_MAX_12H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_12) || (input_len > DISPLAY_LEN_MAX_12)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_12) || (input_len > DISPLAY_LEN_MAX_12)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -4587,14 +4549,7 @@ int md5md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU int vb3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_2611H) || (input_len > DISPLAY_LEN_MAX_2611H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_2611) || (input_len > DISPLAY_LEN_MAX_2611)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_2611) || (input_len > DISPLAY_LEN_MAX_2611)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -4634,14 +4589,7 @@ int vb3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED int vb30_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_2711H) || (input_len > DISPLAY_LEN_MAX_2711H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_2711) || (input_len > DISPLAY_LEN_MAX_2711)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_2711) || (input_len > DISPLAY_LEN_MAX_2711)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -4673,14 +4621,7 @@ int vb30_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE int dcc_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_1100H) || (input_len > DISPLAY_LEN_MAX_1100H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_1100) || (input_len > DISPLAY_LEN_MAX_1100)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_1100) || (input_len > DISPLAY_LEN_MAX_1100)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -4720,14 +4661,7 @@ int dcc_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED int ipb2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_2811H) || (input_len > DISPLAY_LEN_MAX_2811H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_2811) || (input_len > DISPLAY_LEN_MAX_2811)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_2811) || (input_len > DISPLAY_LEN_MAX_2811)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -5250,14 +5184,7 @@ int mssql2012_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_ int oracleh_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig) { - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if ((input_len < DISPLAY_LEN_MIN_3100H) || (input_len > DISPLAY_LEN_MAX_3100H)) return (PARSER_GLOBAL_LENGTH); - } - else - { - if ((input_len < DISPLAY_LEN_MIN_3100) || (input_len > DISPLAY_LEN_MAX_3100)) return (PARSER_GLOBAL_LENGTH); - } + if ((input_len < DISPLAY_LEN_MIN_3100) || (input_len > DISPLAY_LEN_MAX_3100)) return (PARSER_GLOBAL_LENGTH); u32 *digest = (u32 *) hash_buf->digest; @@ -24781,6 +24708,29 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) case 14900: hashconfig->pw_max = 10; break; // Skip32 max } + // salt_min and salt_max : this limit is only interessting for generic hash types that support a salt + + hashconfig->salt_min = SALT_MIN; + hashconfig->salt_max = SALT_MAX; + + if (user_options->length_limit_disable == true) + { + // nothing to do + } + else + { + hashconfig->pw_max = SALT_MAX_OLD; + } + + if (hashconfig->salt_type == SALT_TYPE_INTERN) + { + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + hashconfig->salt_min *= 2; + hashconfig->salt_max *= 2; + } + } + return 0; }