From 7b36d7ebf8ca3a1d7fdfa0812f3b478911b7291d Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Wed, 31 Aug 2022 10:53:56 +0200 Subject: [PATCH] Fixed autodetect memory allocation for temporary hashes for LUKS v1 (legacy) in --identify mode --- docs/changes.txt | 7 ++++--- src/hashcat.c | 16 +++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 75aa3757e..a319a12c4 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -47,6 +47,7 @@ ## - Fixed accepted salt length by PKCS#8 Private Keys modules +- Fixed autodetect memory allocation for temporary hashes for LUKS v1 (legacy) in --identify mode - Fixed backend active devices checks - Fixed building error on Raspberry Pi - Fixed display problem of incorrect negative values in case of large numbers @@ -68,9 +69,9 @@ - Fixed password limit in optimized kernel for hash-mode 10700 - Fixed password reassembling function reporting an incorrect candidate in some cases when the correct candidate has zero length - Fixed undefined function call to hc_byte_perm_S() in hash-mode 17010 on non-CUDA compute devices -- Fixed Unit Test early exit on luks test file download/extract failure -- Fixed Unit Test false negative if there are spaces in the filesystem path to hashcat -- Fixed Unit Test salt-max in case of optimized kernel, with hash-type 22 and 23 +- Fixed unit test early exit on luks test file download/extract failure +- Fixed unit test false negative if there are spaces in the filesystem path to hashcat +- Fixed unit test salt-max in case of optimized kernel, with hash-type 22 and 23 - Fixed usage of --rule-right (-k) in -a 7 with optimized (-O) kernels - Fixed wordlist handling in -m 3000 when candidate passwords use the $HEX[...] syntax diff --git a/src/hashcat.c b/src/hashcat.c index 76d4b7972..9aed03dbe 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -1391,12 +1391,18 @@ bool autodetect_hashmode_test (hashcat_ctx_t *hashcat_ctx) hash_info->orighash = (char *) hcmalloc (256); hash_info->split = (split_t *) hcmalloc (sizeof (split_t)); - hash_t *hashes_buf = (hash_t *) hcmalloc (sizeof (hash_t)); + // this is required for multi hash iterations in binary files, for instance used in -m 14600 + #define HASHES_IN_BINARY 10 - hashes_buf->digest = digest; - hashes_buf->salt = salt; - hashes_buf->esalt = esalt; - hashes_buf->hook_salt = hook_salt; + hash_t *hashes_buf = (hash_t *) hccalloc (HASHES_IN_BINARY, sizeof (hash_t)); + + for (int i = 0; i < HASHES_IN_BINARY; i++) + { + hashes_buf[i].digest = digest; + hashes_buf[i].salt = salt; + hashes_buf[i].esalt = esalt; + hashes_buf[i].hook_salt = hook_salt; + } hashes->hashes_buf = hashes_buf; hashes->digests_buf = digest;