mirror of
https://github.com/hashcat/hashcat.git
synced 2025-06-15 12:38:48 +00:00
Fixed race condition in potfile check during removal of empty hashes
This commit is contained in:
parent
62fc3601bb
commit
56f47cabe2
@ -45,6 +45,7 @@
|
|||||||
- Fixed internal access on module option attribute OPTS_TYPE_SUGGEST_KG with the result that it was unused
|
- Fixed internal access on module option attribute OPTS_TYPE_SUGGEST_KG with the result that it was unused
|
||||||
- Fixed invalid handling of outfile folder entries for -m 22000
|
- Fixed invalid handling of outfile folder entries for -m 22000
|
||||||
- Fixed password reassembling for cracked hashes on host for slow hashes in optimized mode that are longer than 32 characters
|
- Fixed password reassembling for cracked hashes on host for slow hashes in optimized mode that are longer than 32 characters
|
||||||
|
- Fixed race condition in potfile check during removal of empty hashes
|
||||||
- Fixed race condition resulting in out of memory error on startup if multiple hashcat instances are started at the same time
|
- Fixed race condition resulting in out of memory error on startup if multiple hashcat instances are started at the same time
|
||||||
- Fixed rare case of misalignment of the status prompt when other user warnings are shown within the hashcat output
|
- Fixed rare case of misalignment of the status prompt when other user warnings are shown within the hashcat output
|
||||||
- Fixed too early execution of some module functions which could make use of non-final values opts_type and opti_type
|
- Fixed too early execution of some module functions which could make use of non-final values opts_type and opti_type
|
||||||
|
@ -27,6 +27,7 @@ int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx);
|
|||||||
int hashes_init_stage4 (hashcat_ctx_t *hashcat_ctx);
|
int hashes_init_stage4 (hashcat_ctx_t *hashcat_ctx);
|
||||||
int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx);
|
int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx);
|
||||||
int hashes_init_benchmark (hashcat_ctx_t *hashcat_ctx);
|
int hashes_init_benchmark (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
int hashes_init_zerohash (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
void hashes_destroy (hashcat_ctx_t *hashcat_ctx);
|
void hashes_destroy (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
|
@ -508,6 +508,12 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
EVENT (EVENT_POTFILE_REMOVE_PARSE_POST);
|
EVENT (EVENT_POTFILE_REMOVE_PARSE_POST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* zero hash removes
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (hashes_init_zerohash (hashcat_ctx) == -1) return -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load hashes, stage 3, update cracked results from potfile
|
* load hashes, stage 3, update cracked results from potfile
|
||||||
*/
|
*/
|
||||||
|
73
src/hashes.c
73
src/hashes.c
@ -2048,6 +2048,79 @@ int hashes_init_benchmark (hashcat_ctx_t *hashcat_ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int hashes_init_zerohash (hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
const module_ctx_t *module_ctx = hashcat_ctx->module_ctx;
|
||||||
|
|
||||||
|
// do not use this unless really needed, for example as in LM
|
||||||
|
|
||||||
|
if (module_ctx->module_hash_decode_zero_hash == MODULE_DEFAULT) return 0;
|
||||||
|
|
||||||
|
hash_t *hashes_buf = hashes->hashes_buf;
|
||||||
|
u32 hashes_cnt = hashes->hashes_cnt;
|
||||||
|
|
||||||
|
// no solution for these special hash types (for instane because they use hashfile in output etc)
|
||||||
|
|
||||||
|
hash_t hash_buf;
|
||||||
|
|
||||||
|
hash_buf.digest = hcmalloc (hashconfig->dgst_size);
|
||||||
|
hash_buf.salt = NULL;
|
||||||
|
hash_buf.esalt = NULL;
|
||||||
|
hash_buf.hook_salt = NULL;
|
||||||
|
hash_buf.cracked = 0;
|
||||||
|
hash_buf.hash_info = NULL;
|
||||||
|
hash_buf.pw_buf = NULL;
|
||||||
|
hash_buf.pw_len = 0;
|
||||||
|
|
||||||
|
if (hashconfig->is_salted == true)
|
||||||
|
{
|
||||||
|
hash_buf.salt = (salt_t *) hcmalloc (sizeof (salt_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hashconfig->esalt_size > 0)
|
||||||
|
{
|
||||||
|
hash_buf.esalt = hcmalloc (hashconfig->esalt_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hashconfig->hook_salt_size > 0)
|
||||||
|
{
|
||||||
|
hash_buf.hook_salt = hcmalloc (hashconfig->hook_salt_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
module_ctx->module_hash_decode_zero_hash (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info);
|
||||||
|
|
||||||
|
hash_t *found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash_no_salt, (void *) hashconfig);
|
||||||
|
|
||||||
|
if (found != NULL)
|
||||||
|
{
|
||||||
|
found->pw_buf = (char *) hcmalloc (1);
|
||||||
|
found->pw_len = 0;
|
||||||
|
|
||||||
|
found->cracked = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hashconfig->esalt_size > 0)
|
||||||
|
{
|
||||||
|
hcfree (hash_buf.esalt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hashconfig->hook_salt_size > 0)
|
||||||
|
{
|
||||||
|
hcfree (hash_buf.hook_salt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hashconfig->is_salted == true)
|
||||||
|
{
|
||||||
|
hcfree (hash_buf.salt);
|
||||||
|
}
|
||||||
|
|
||||||
|
hcfree (hash_buf.digest);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void hashes_destroy (hashcat_ctx_t *hashcat_ctx)
|
void hashes_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
|
@ -411,12 +411,12 @@ static void main_potfile_num_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, M
|
|||||||
{
|
{
|
||||||
if (potfile_remove_cracks == 1)
|
if (potfile_remove_cracks == 1)
|
||||||
{
|
{
|
||||||
event_log_info (hashcat_ctx, "INFO: Removed 1 hash found in potfile.");
|
event_log_info (hashcat_ctx, "INFO: Removed 1 hash found as as potfile entry or as empty hash.");
|
||||||
event_log_info (hashcat_ctx, NULL);
|
event_log_info (hashcat_ctx, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event_log_info (hashcat_ctx, "INFO: Removed %d hashes found in potfile.", potfile_remove_cracks);
|
event_log_info (hashcat_ctx, "INFO: Removed %d hashes found as potfile entries or as empty hash.", potfile_remove_cracks);
|
||||||
event_log_info (hashcat_ctx, NULL);
|
event_log_info (hashcat_ctx, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,24 +498,6 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not use this unless really needed, for example as in LM
|
|
||||||
|
|
||||||
if (module_ctx->module_hash_decode_zero_hash != MODULE_DEFAULT)
|
|
||||||
{
|
|
||||||
module_ctx->module_hash_decode_zero_hash (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info);
|
|
||||||
|
|
||||||
if (hashconfig->potfile_keep_all_hashes == true)
|
|
||||||
{
|
|
||||||
potfile_update_hashes (hashcat_ctx, &hash_buf, NULL, 0, all_hashes_tree);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hash_t *found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash_no_salt, (void *) hashconfig);
|
|
||||||
|
|
||||||
potfile_update_hash (hashcat_ctx, found, NULL, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const int rc = potfile_read_open (hashcat_ctx);
|
const int rc = potfile_read_open (hashcat_ctx);
|
||||||
|
|
||||||
if (rc == -1) return -1;
|
if (rc == -1) return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user