1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-27 02:18:21 +00:00

Fix a bug in wpa_essid_reuse_next() destroying reuse PBKDF2 intermediate keys if duplicate essid logic

This commit is contained in:
jsteube 2017-02-28 10:20:46 +01:00
parent fea62b78dc
commit c47f9d4b3e

View File

@ -14952,25 +14952,30 @@ void wpa_essid_reuse (hashcat_ctx_t *hashcat_ctx)
void wpa_essid_reuse_next (hashcat_ctx_t *hashcat_ctx, const u32 salt_idx_cracked)
{
// the first essid salt has been cracked, but it's possible others with the same essid are not
// thus we have to update essid_reuse to find the next uncracked salt with the same essid
hashes_t *hashes = hashcat_ctx->hashes;
salt_t *salts_buf = hashes->salts_buf;
wpa_t *esalts_buf = hashes->esalts_buf;
// the first essid salt has been cracked?
// since there's always just one with essid_reuse == 0 (which is always the first uncracked of N handshakes)
// we can do the following check:
if (esalts_buf[salt_idx_cracked].essid_reuse != 0) return;
// it's possible more handshakes with the same essid are following,
// thus we have to update the next essid_reuse with the same essid
const u32 salts_cnt = hashes->salts_cnt;
const u32 salts_idx_next = salt_idx_cracked + 1;
if (salts_idx_next == salts_cnt) return;
if (memcmp ((char *) salts_buf[salts_idx_next].salt_buf, (char *) salts_buf[salt_idx_cracked].salt_buf, salts_buf[salts_idx_next].salt_len) == 0)
{
esalts_buf[salts_idx_next].essid_reuse = 0;
}
if (memcmp ((char *) salts_buf[salts_idx_next].salt_buf, (char *) salts_buf[salt_idx_cracked].salt_buf, salts_buf[salts_idx_next].salt_len)) return;
esalts_buf[salts_idx_next].essid_reuse = 0;
}
int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_len, const u32 salt_pos, const u32 digest_pos)