mirror of
https://github.com/hashcat/hashcat
synced 2024-12-23 14:13:43 +01:00
Added hash-mode 18300 (Apple File System)
Fixes https://github.com/hashcat/hashcat/issues/1686
This commit is contained in:
parent
a5818facf2
commit
a4200ba167
422
OpenCL/m18300-pure.cl
Normal file
422
OpenCL/m18300-pure.cl
Normal file
@ -0,0 +1,422 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#define NEW_SIMD_CODE
|
||||
|
||||
#include "inc_vendor.cl"
|
||||
#include "inc_hash_constants.h"
|
||||
#include "inc_hash_functions.cl"
|
||||
#include "inc_types.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha256.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
|
||||
#define COMPARE_S "inc_comp_single.cl"
|
||||
#define COMPARE_M "inc_comp_multi.cl"
|
||||
|
||||
DECLSPEC void hmac_sha256_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
|
||||
{
|
||||
digest[0] = ipad[0];
|
||||
digest[1] = ipad[1];
|
||||
digest[2] = ipad[2];
|
||||
digest[3] = ipad[3];
|
||||
digest[4] = ipad[4];
|
||||
digest[5] = ipad[5];
|
||||
digest[6] = ipad[6];
|
||||
digest[7] = ipad[7];
|
||||
|
||||
sha256_transform_vector (w0, w1, w2, w3, digest);
|
||||
|
||||
w0[0] = digest[0];
|
||||
w0[1] = digest[1];
|
||||
w0[2] = digest[2];
|
||||
w0[3] = digest[3];
|
||||
w1[0] = digest[4];
|
||||
w1[1] = digest[5];
|
||||
w1[2] = digest[6];
|
||||
w1[3] = digest[7];
|
||||
w2[0] = 0x80000000;
|
||||
w2[1] = 0;
|
||||
w2[2] = 0;
|
||||
w2[3] = 0;
|
||||
w3[0] = 0;
|
||||
w3[1] = 0;
|
||||
w3[2] = 0;
|
||||
w3[3] = (64 + 32) * 8;
|
||||
|
||||
digest[0] = opad[0];
|
||||
digest[1] = opad[1];
|
||||
digest[2] = opad[2];
|
||||
digest[3] = opad[3];
|
||||
digest[4] = opad[4];
|
||||
digest[5] = opad[5];
|
||||
digest[6] = opad[6];
|
||||
digest[7] = opad[7];
|
||||
|
||||
sha256_transform_vector (w0, w1, w2, w3, digest);
|
||||
}
|
||||
|
||||
__kernel void m18300_init (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global apple_secure_notes_tmp_t *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const apple_secure_notes_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
|
||||
{
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
sha256_hmac_ctx_t sha256_hmac_ctx;
|
||||
|
||||
sha256_hmac_init_global_swap (&sha256_hmac_ctx, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
tmps[gid].ipad[0] = sha256_hmac_ctx.ipad.h[0];
|
||||
tmps[gid].ipad[1] = sha256_hmac_ctx.ipad.h[1];
|
||||
tmps[gid].ipad[2] = sha256_hmac_ctx.ipad.h[2];
|
||||
tmps[gid].ipad[3] = sha256_hmac_ctx.ipad.h[3];
|
||||
tmps[gid].ipad[4] = sha256_hmac_ctx.ipad.h[4];
|
||||
tmps[gid].ipad[5] = sha256_hmac_ctx.ipad.h[5];
|
||||
tmps[gid].ipad[6] = sha256_hmac_ctx.ipad.h[6];
|
||||
tmps[gid].ipad[7] = sha256_hmac_ctx.ipad.h[7];
|
||||
|
||||
tmps[gid].opad[0] = sha256_hmac_ctx.opad.h[0];
|
||||
tmps[gid].opad[1] = sha256_hmac_ctx.opad.h[1];
|
||||
tmps[gid].opad[2] = sha256_hmac_ctx.opad.h[2];
|
||||
tmps[gid].opad[3] = sha256_hmac_ctx.opad.h[3];
|
||||
tmps[gid].opad[4] = sha256_hmac_ctx.opad.h[4];
|
||||
tmps[gid].opad[5] = sha256_hmac_ctx.opad.h[5];
|
||||
tmps[gid].opad[6] = sha256_hmac_ctx.opad.h[6];
|
||||
tmps[gid].opad[7] = sha256_hmac_ctx.opad.h[7];
|
||||
|
||||
sha256_hmac_update_global_swap (&sha256_hmac_ctx, esalt_bufs[digests_offset].ZCRYPTOSALT, 16);
|
||||
|
||||
for (u32 i = 0, j = 1; i < 8; i += 8, j += 1)
|
||||
{
|
||||
sha256_hmac_ctx_t sha256_hmac_ctx2 = sha256_hmac_ctx;
|
||||
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
w0[0] = j;
|
||||
w0[1] = 0;
|
||||
w0[2] = 0;
|
||||
w0[3] = 0;
|
||||
w1[0] = 0;
|
||||
w1[1] = 0;
|
||||
w1[2] = 0;
|
||||
w1[3] = 0;
|
||||
w2[0] = 0;
|
||||
w2[1] = 0;
|
||||
w2[2] = 0;
|
||||
w2[3] = 0;
|
||||
w3[0] = 0;
|
||||
w3[1] = 0;
|
||||
w3[2] = 0;
|
||||
w3[3] = 0;
|
||||
|
||||
sha256_hmac_update_64 (&sha256_hmac_ctx2, w0, w1, w2, w3, 4);
|
||||
|
||||
sha256_hmac_final (&sha256_hmac_ctx2);
|
||||
|
||||
tmps[gid].dgst[i + 0] = sha256_hmac_ctx2.opad.h[0];
|
||||
tmps[gid].dgst[i + 1] = sha256_hmac_ctx2.opad.h[1];
|
||||
tmps[gid].dgst[i + 2] = sha256_hmac_ctx2.opad.h[2];
|
||||
tmps[gid].dgst[i + 3] = sha256_hmac_ctx2.opad.h[3];
|
||||
tmps[gid].dgst[i + 4] = sha256_hmac_ctx2.opad.h[4];
|
||||
tmps[gid].dgst[i + 5] = sha256_hmac_ctx2.opad.h[5];
|
||||
tmps[gid].dgst[i + 6] = sha256_hmac_ctx2.opad.h[6];
|
||||
tmps[gid].dgst[i + 7] = sha256_hmac_ctx2.opad.h[7];
|
||||
|
||||
tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0];
|
||||
tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1];
|
||||
tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2];
|
||||
tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3];
|
||||
tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4];
|
||||
tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5];
|
||||
tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6];
|
||||
tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7];
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m18300_loop (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global apple_secure_notes_tmp_t *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const apple_secure_notes_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
if ((gid * VECT_SIZE) >= gid_max) return;
|
||||
|
||||
u32x ipad[8];
|
||||
u32x opad[8];
|
||||
|
||||
ipad[0] = packv (tmps, ipad, gid, 0);
|
||||
ipad[1] = packv (tmps, ipad, gid, 1);
|
||||
ipad[2] = packv (tmps, ipad, gid, 2);
|
||||
ipad[3] = packv (tmps, ipad, gid, 3);
|
||||
ipad[4] = packv (tmps, ipad, gid, 4);
|
||||
ipad[5] = packv (tmps, ipad, gid, 5);
|
||||
ipad[6] = packv (tmps, ipad, gid, 6);
|
||||
ipad[7] = packv (tmps, ipad, gid, 7);
|
||||
|
||||
opad[0] = packv (tmps, opad, gid, 0);
|
||||
opad[1] = packv (tmps, opad, gid, 1);
|
||||
opad[2] = packv (tmps, opad, gid, 2);
|
||||
opad[3] = packv (tmps, opad, gid, 3);
|
||||
opad[4] = packv (tmps, opad, gid, 4);
|
||||
opad[5] = packv (tmps, opad, gid, 5);
|
||||
opad[6] = packv (tmps, opad, gid, 6);
|
||||
opad[7] = packv (tmps, opad, gid, 7);
|
||||
|
||||
for (u32 i = 0; i < 8; i += 8)
|
||||
{
|
||||
u32x dgst[8];
|
||||
u32x out[8];
|
||||
|
||||
dgst[0] = packv (tmps, dgst, gid, i + 0);
|
||||
dgst[1] = packv (tmps, dgst, gid, i + 1);
|
||||
dgst[2] = packv (tmps, dgst, gid, i + 2);
|
||||
dgst[3] = packv (tmps, dgst, gid, i + 3);
|
||||
dgst[4] = packv (tmps, dgst, gid, i + 4);
|
||||
dgst[5] = packv (tmps, dgst, gid, i + 5);
|
||||
dgst[6] = packv (tmps, dgst, gid, i + 6);
|
||||
dgst[7] = packv (tmps, dgst, gid, i + 7);
|
||||
|
||||
out[0] = packv (tmps, out, gid, i + 0);
|
||||
out[1] = packv (tmps, out, gid, i + 1);
|
||||
out[2] = packv (tmps, out, gid, i + 2);
|
||||
out[3] = packv (tmps, out, gid, i + 3);
|
||||
out[4] = packv (tmps, out, gid, i + 4);
|
||||
out[5] = packv (tmps, out, gid, i + 5);
|
||||
out[6] = packv (tmps, out, gid, i + 6);
|
||||
out[7] = packv (tmps, out, gid, i + 7);
|
||||
|
||||
for (u32 j = 0; j < loop_cnt; j++)
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = dgst[0];
|
||||
w0[1] = dgst[1];
|
||||
w0[2] = dgst[2];
|
||||
w0[3] = dgst[3];
|
||||
w1[0] = dgst[4];
|
||||
w1[1] = dgst[5];
|
||||
w1[2] = dgst[6];
|
||||
w1[3] = dgst[7];
|
||||
w2[0] = 0x80000000;
|
||||
w2[1] = 0;
|
||||
w2[2] = 0;
|
||||
w2[3] = 0;
|
||||
w3[0] = 0;
|
||||
w3[1] = 0;
|
||||
w3[2] = 0;
|
||||
w3[3] = (64 + 32) * 8;
|
||||
|
||||
hmac_sha256_run_V (w0, w1, w2, w3, ipad, opad, dgst);
|
||||
|
||||
out[0] ^= dgst[0];
|
||||
out[1] ^= dgst[1];
|
||||
out[2] ^= dgst[2];
|
||||
out[3] ^= dgst[3];
|
||||
out[4] ^= dgst[4];
|
||||
out[5] ^= dgst[5];
|
||||
out[6] ^= dgst[6];
|
||||
out[7] ^= dgst[7];
|
||||
}
|
||||
|
||||
unpackv (tmps, dgst, gid, i + 0, dgst[0]);
|
||||
unpackv (tmps, dgst, gid, i + 1, dgst[1]);
|
||||
unpackv (tmps, dgst, gid, i + 2, dgst[2]);
|
||||
unpackv (tmps, dgst, gid, i + 3, dgst[3]);
|
||||
unpackv (tmps, dgst, gid, i + 4, dgst[4]);
|
||||
unpackv (tmps, dgst, gid, i + 5, dgst[5]);
|
||||
unpackv (tmps, dgst, gid, i + 6, dgst[6]);
|
||||
unpackv (tmps, dgst, gid, i + 7, dgst[7]);
|
||||
|
||||
unpackv (tmps, out, gid, i + 0, out[0]);
|
||||
unpackv (tmps, out, gid, i + 1, out[1]);
|
||||
unpackv (tmps, out, gid, i + 2, out[2]);
|
||||
unpackv (tmps, out, gid, i + 3, out[3]);
|
||||
unpackv (tmps, out, gid, i + 4, out[4]);
|
||||
unpackv (tmps, out, gid, i + 5, out[5]);
|
||||
unpackv (tmps, out, gid, i + 6, out[6]);
|
||||
unpackv (tmps, out, gid, i + 7, out[7]);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m18300_comp (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global apple_secure_notes_tmp_t *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const apple_secure_notes_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u32 s_td0[256];
|
||||
__local u32 s_td1[256];
|
||||
__local u32 s_td2[256];
|
||||
__local u32 s_td3[256];
|
||||
__local u32 s_td4[256];
|
||||
|
||||
__local u32 s_te0[256];
|
||||
__local u32 s_te1[256];
|
||||
__local u32 s_te2[256];
|
||||
__local u32 s_te3[256];
|
||||
__local u32 s_te4[256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u32a *s_td0 = td0;
|
||||
__constant u32a *s_td1 = td1;
|
||||
__constant u32a *s_td2 = td2;
|
||||
__constant u32a *s_td3 = td3;
|
||||
__constant u32a *s_td4 = td4;
|
||||
|
||||
__constant u32a *s_te0 = te0;
|
||||
__constant u32a *s_te1 = te1;
|
||||
__constant u32a *s_te2 = te2;
|
||||
__constant u32a *s_te3 = te3;
|
||||
__constant u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 ukey[8];
|
||||
|
||||
ukey[0] = tmps[gid].out[0];
|
||||
ukey[1] = tmps[gid].out[1];
|
||||
ukey[2] = tmps[gid].out[2];
|
||||
ukey[3] = tmps[gid].out[3];
|
||||
ukey[4] = tmps[gid].out[4];
|
||||
ukey[5] = tmps[gid].out[5];
|
||||
ukey[6] = tmps[gid].out[6];
|
||||
ukey[7] = tmps[gid].out[7];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, ukey, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
// unwrap and compare
|
||||
|
||||
u32 A[2];
|
||||
u32 P1[2];
|
||||
u32 P2[2];
|
||||
u32 P3[2];
|
||||
u32 P4[2];
|
||||
|
||||
A[0] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[0]);
|
||||
A[1] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[1]);
|
||||
P1[0] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[2]);
|
||||
P1[1] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[3]);
|
||||
P2[0] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[4]);
|
||||
P2[1] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[5]);
|
||||
P3[0] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[6]);
|
||||
P3[1] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[7]);
|
||||
P4[0] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[8]);
|
||||
P4[1] = swap32_S (esalt_bufs[digests_offset].ZCRYPTOWRAPPEDKEY[9]);
|
||||
|
||||
for (int j = 5; j >= 0; j--)
|
||||
{
|
||||
const u32 it1 = 4 * j + 1;
|
||||
const u32 it2 = 4 * j + 2;
|
||||
const u32 it3 = 4 * j + 3;
|
||||
const u32 it4 = 4 * j + 4;
|
||||
|
||||
u32 in[4];
|
||||
u32 out[4];
|
||||
|
||||
// N = 4
|
||||
|
||||
in[0] = A[0];
|
||||
in[1] = A[1] ^ it4;
|
||||
in[2] = P4[0];
|
||||
in[3] = P4[1];
|
||||
|
||||
AES256_decrypt (ks, in, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
A[0] = out[0];
|
||||
A[1] = out[1];
|
||||
P4[0] = out[2];
|
||||
P4[1] = out[3];
|
||||
|
||||
// N = 3
|
||||
|
||||
in[0] = A[0];
|
||||
in[1] = A[1] ^ it3;
|
||||
in[2] = P3[0];
|
||||
in[3] = P3[1];
|
||||
|
||||
AES256_decrypt (ks, in, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
A[0] = out[0];
|
||||
A[1] = out[1];
|
||||
P3[0] = out[2];
|
||||
P3[1] = out[3];
|
||||
|
||||
// N = 2
|
||||
|
||||
in[0] = A[0];
|
||||
in[1] = A[1] ^ it2;
|
||||
in[2] = P2[0];
|
||||
in[3] = P2[1];
|
||||
|
||||
AES256_decrypt (ks, in, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
A[0] = out[0];
|
||||
A[1] = out[1];
|
||||
P2[0] = out[2];
|
||||
P2[1] = out[3];
|
||||
|
||||
// N = 1
|
||||
|
||||
in[0] = A[0];
|
||||
in[1] = A[1] ^ it1;
|
||||
in[2] = P1[0];
|
||||
in[3] = P1[1];
|
||||
|
||||
AES256_decrypt (ks, in, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
A[0] = out[0];
|
||||
A[1] = out[1];
|
||||
P1[0] = out[2];
|
||||
P1[1] = out[3];
|
||||
}
|
||||
|
||||
if ((A[0] == 0xa6a6a6a6)
|
||||
&& (A[1] == 0xa6a6a6a6))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0);
|
||||
}
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
- Added hash-mode 13772 (VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1024 bit)
|
||||
- Added hash-mode 13773 (VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1536 bit)
|
||||
- Added hash-mode 18200 (Kerberos 5 AS-REP etype 23)
|
||||
- Added hash-mode 18300 (Apple File System)
|
||||
|
||||
##
|
||||
## Improvements
|
||||
|
@ -234,6 +234,7 @@ NVIDIA GPUs require "NVIDIA Driver" (367.x or later)
|
||||
- VeraCrypt
|
||||
- LUKS
|
||||
- FileVault 2
|
||||
- Apple File System
|
||||
- MS Office <= 2003
|
||||
- MS Office 2007
|
||||
- MS Office 2010
|
||||
|
@ -176,7 +176,7 @@ _hashcat ()
|
||||
{
|
||||
local VERSION=5.0.0
|
||||
|
||||
local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16801 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200"
|
||||
local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16801 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 18300"
|
||||
local ATTACK_MODES="0 1 3 6 7"
|
||||
local HCCAPX_MESSAGE_PAIRS="0 1 2 3 4 5"
|
||||
local OUTFILE_FORMATS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
||||
|
@ -1363,6 +1363,7 @@ typedef enum kern_type
|
||||
KERN_TYPE_KECCAK_512 = 18000,
|
||||
KERN_TYPE_TOTP_HMACSHA1 = 18100,
|
||||
KERN_TYPE_KRB5ASREP = 18200,
|
||||
KERN_TYPE_APFS = 18300,
|
||||
KERN_TYPE_PLAINTEXT = 99999,
|
||||
|
||||
} kern_type_t;
|
||||
@ -1630,6 +1631,7 @@ int wpa_pmkid_pbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_bu
|
||||
int wpa_pmkid_pmk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig);
|
||||
int ansible_vault_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig);
|
||||
int totp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig);
|
||||
int apfs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig);
|
||||
|
||||
/**
|
||||
* hook functions
|
||||
|
181
src/interface.c
181
src/interface.c
@ -297,6 +297,7 @@ static const char *ST_HASH_17900 = "5804b7ada5806ba79540100e9a7ef493654ff2a21d94
|
||||
static const char *ST_HASH_18000 = "2fbf5c9080f0a704de2e915ba8fdae6ab00bbc026b2c1c8fa07da1239381c6b7f4dfd399bf9652500da723694a4c719587dd0219cb30eabe61210a8ae4dc0b03";
|
||||
static const char *ST_HASH_18100 = "597056:3600";
|
||||
static const char *ST_HASH_18200 = "$krb5asrep$23$user@domain.com:3e156ada591263b8aab0965f5aebd837$007497cb51b6c8116d6407a782ea0e1c5402b17db7afa6b05a6d30ed164a9933c754d720e279c6c573679bd27128fe77e5fea1f72334c1193c8ff0b370fadc6368bf2d49bbfdba4c5dccab95e8c8ebfdc75f438a0797dbfb2f8a1a5f4c423f9bfc1fea483342a11bd56a216f4d5158ccc4b224b52894fadfba3957dfe4b6b8f5f9f9fe422811a314768673e0c924340b8ccb84775ce9defaa3baa0910b676ad0036d13032b0dd94e3b13903cc738a7b6d00b0b3c210d1f972a6c7cae9bd3c959acf7565be528fc179118f28c679f6deeee1456f0781eb8154e18e49cb27b64bf74cd7112a0ebae2102ac";
|
||||
static const char *ST_HASH_18300 = "$fvde$2$16$58778104701476542047675521040224$20000$39602e86b7cea4a34f4ff69ff6ed706d68954ee474de1d2a9f6a6f2d24d172001e484c1d4eaa237d";
|
||||
static const char *ST_HASH_99999 = "hashcat";
|
||||
|
||||
static const char *OPTI_STR_OPTIMIZED_KERNEL = "Optimized-Kernel";
|
||||
@ -558,6 +559,7 @@ static const char *HT_17900 = "Keccak-384";
|
||||
static const char *HT_18000 = "Keccak-512";
|
||||
static const char *HT_18100 = "TOTP (HMAC-SHA1)";
|
||||
static const char *HT_18200 = "Kerberos 5 AS-REP etype 23";
|
||||
static const char *HT_18300 = "Apple File System";
|
||||
static const char *HT_99999 = "Plaintext";
|
||||
|
||||
static const char *HT_00011 = "Joomla < 2.5.18";
|
||||
@ -713,6 +715,7 @@ static const char *SIGNATURE_ETHEREUM_PRESALE = "$ethereum$w";
|
||||
static const char *SIGNATURE_ELECTRUM_WALLET = "$electrum$";
|
||||
static const char *SIGNATURE_FILEVAULT2 = "$fvde$";
|
||||
static const char *SIGNATURE_ANSIBLE_VAULT = "$ansible$";
|
||||
static const char *SIGNATURE_APFS = "$fvde$";
|
||||
|
||||
/**
|
||||
* decoder / encoder
|
||||
@ -17882,6 +17885,8 @@ int filevault2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
|
||||
|
||||
const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10);
|
||||
|
||||
if (Z_PK != 1) return (PARSER_SIGNATURE_UNMATCHED);
|
||||
|
||||
apple_secure_notes->Z_PK = Z_PK;
|
||||
|
||||
// ZCRYPTOSALT
|
||||
@ -18357,7 +18362,134 @@ int ansible_vault_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA
|
||||
digest[7] = byte_swap_32 (digest[7]);
|
||||
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
int apfs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig)
|
||||
{
|
||||
u32 *digest = (u32 *) hash_buf->digest;
|
||||
|
||||
salt_t *salt = hash_buf->salt;
|
||||
|
||||
apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) hash_buf->esalt;
|
||||
|
||||
token_t token;
|
||||
|
||||
token.token_cnt = 6;
|
||||
|
||||
token.signatures_cnt = 1;
|
||||
token.signatures_buf[0] = SIGNATURE_APFS;
|
||||
|
||||
token.len[0] = 6;
|
||||
token.attr[0] = TOKEN_ATTR_FIXED_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_SIGNATURE;
|
||||
|
||||
token.sep[1] = '$';
|
||||
token.len_min[1] = 1;
|
||||
token.len_max[1] = 10;
|
||||
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.sep[2] = '$';
|
||||
token.len_min[2] = 1;
|
||||
token.len_max[2] = 6;
|
||||
token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.sep[3] = '$';
|
||||
token.len_min[3] = 32;
|
||||
token.len_max[3] = 32;
|
||||
token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.sep[4] = '$';
|
||||
token.len_min[4] = 1;
|
||||
token.len_max[4] = 6;
|
||||
token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.sep[5] = '$';
|
||||
token.len_min[5] = 80;
|
||||
token.len_max[5] = 80;
|
||||
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token);
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
// Z_PK
|
||||
|
||||
u8 *Z_PK_pos = token.buf[1];
|
||||
|
||||
const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10);
|
||||
|
||||
if (Z_PK != 2) return (PARSER_SIGNATURE_UNMATCHED);
|
||||
|
||||
apple_secure_notes->Z_PK = Z_PK;
|
||||
|
||||
// ZCRYPTOSALT
|
||||
|
||||
u8 *ZCRYPTOSALT_pos = token.buf[3];
|
||||
|
||||
apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]);
|
||||
apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]);
|
||||
apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]);
|
||||
apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]);
|
||||
apple_secure_notes->ZCRYPTOSALT[ 4] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[ 5] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[ 6] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[ 7] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[ 8] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[ 9] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[10] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[11] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[12] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[13] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[14] = 0;
|
||||
apple_secure_notes->ZCRYPTOSALT[15] = 0;
|
||||
|
||||
// ZCRYPTOITERATIONCOUNT
|
||||
|
||||
u8 *ZCRYPTOITERATIONCOUNT_pos = token.buf[4];
|
||||
|
||||
const u32 ZCRYPTOITERATIONCOUNT = hc_strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10);
|
||||
|
||||
apple_secure_notes->ZCRYPTOITERATIONCOUNT = ZCRYPTOITERATIONCOUNT;
|
||||
|
||||
// ZCRYPTOWRAPPEDKEY
|
||||
|
||||
u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[5];
|
||||
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[6] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[48]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[7] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[56]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[8] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[64]);
|
||||
apple_secure_notes->ZCRYPTOWRAPPEDKEY[9] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[72]);
|
||||
|
||||
// fake salt
|
||||
|
||||
salt->salt_buf[0] = apple_secure_notes->ZCRYPTOSALT[0];
|
||||
salt->salt_buf[1] = apple_secure_notes->ZCRYPTOSALT[1];
|
||||
salt->salt_buf[2] = apple_secure_notes->ZCRYPTOSALT[2];
|
||||
salt->salt_buf[3] = apple_secure_notes->ZCRYPTOSALT[3];
|
||||
salt->salt_buf[4] = apple_secure_notes->Z_PK;
|
||||
|
||||
salt->salt_iter = apple_secure_notes->ZCRYPTOITERATIONCOUNT - 1;
|
||||
salt->salt_len = 20;
|
||||
|
||||
// fake hash
|
||||
|
||||
digest[0] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[0];
|
||||
digest[1] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[1];
|
||||
digest[2] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[2];
|
||||
digest[3] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[3];
|
||||
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -18819,6 +18951,7 @@ const char *strhashtype (const u32 hash_mode)
|
||||
case 18000: return HT_18000;
|
||||
case 18100: return HT_18100;
|
||||
case 18200: return HT_18200;
|
||||
case 18300: return HT_18300;
|
||||
case 99999: return HT_99999;
|
||||
}
|
||||
|
||||
@ -22648,6 +22781,31 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
|
||||
byte_swap_32 (krb5asrep->checksum[3]),
|
||||
data);
|
||||
}
|
||||
else if (hash_mode == 18300)
|
||||
{
|
||||
apple_secure_notes_t *apple_secure_notess = (apple_secure_notes_t *) esalts_buf;
|
||||
|
||||
apple_secure_notes_t *apple_secure_notes = &apple_secure_notess[digest_cur];
|
||||
|
||||
snprintf (out_buf, out_len - 1, "%s%u$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
|
||||
SIGNATURE_FILEVAULT2,
|
||||
apple_secure_notes->Z_PK,
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[0]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[1]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[2]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[3]),
|
||||
apple_secure_notes->ZCRYPTOITERATIONCOUNT,
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[4]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[5]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[6]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[7]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[8]),
|
||||
byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[9]));
|
||||
}
|
||||
else if (hash_mode == 99999)
|
||||
{
|
||||
char *ptr = (char *) digest_buf;
|
||||
@ -28098,6 +28256,23 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 18300: hashconfig->hash_type = HASH_TYPE_APPLE_SECURE_NOTES;
|
||||
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE;
|
||||
hashconfig->kern_type = KERN_TYPE_APFS;
|
||||
hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2
|
||||
hashconfig->parse_func = apfs_parse_hash;
|
||||
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
|
||||
hashconfig->dgst_pos0 = 0;
|
||||
hashconfig->dgst_pos1 = 1;
|
||||
hashconfig->dgst_pos2 = 2;
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
hashconfig->st_hash = ST_HASH_18300;
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 99999: hashconfig->hash_type = HASH_TYPE_PLAINTEXT;
|
||||
hashconfig->salt_type = SALT_TYPE_NONE;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
@ -28327,6 +28502,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
case 16801: hashconfig->esalt_size = sizeof (wpa_pmkid_t); break;
|
||||
case 16900: hashconfig->esalt_size = sizeof (ansible_vault_t); break;
|
||||
case 18200: hashconfig->esalt_size = sizeof (krb5asrep_t); break;
|
||||
case 18300: hashconfig->esalt_size = sizeof (apple_secure_notes_t); break;
|
||||
}
|
||||
|
||||
// hook_salt_size
|
||||
@ -28443,6 +28619,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
case 16800: hashconfig->tmp_size = sizeof (wpa_pbkdf2_tmp_t); break;
|
||||
case 16801: hashconfig->tmp_size = sizeof (wpa_pmk_tmp_t); break;
|
||||
case 16900: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break;
|
||||
case 18300: hashconfig->tmp_size = sizeof (apple_secure_notes_tmp_t); break;
|
||||
};
|
||||
|
||||
// hook_size
|
||||
@ -29192,6 +29369,8 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo
|
||||
break;
|
||||
case 16900: salt->salt_len = 32;
|
||||
break;
|
||||
case 18300: salt->salt_len = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
// special esalt handling
|
||||
@ -29487,6 +29666,8 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo
|
||||
break;
|
||||
case 16900: salt->salt_iter = ROUNDS_ANSIBLE_VAULT - 1;
|
||||
break;
|
||||
case 18300: salt->salt_iter = ROUNDS_APPLE_SECURE_NOTES - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,6 +367,7 @@ static const char *const USAGE_BIG[] =
|
||||
" Y | 3 = XTS 1536 bit all | Full-Disk Encryption (FDE)",
|
||||
" 14600 | LUKS | Full-Disk Encryption (FDE)",
|
||||
" 16700 | FileVault 2 | Full-Disk Encryption (FDE)",
|
||||
" 18300 | Apple File System | Full-Disk Encryption (FDE)",
|
||||
" 9700 | MS Office <= 2003 $0/$1, MD5 + RC4 | Documents",
|
||||
" 9710 | MS Office <= 2003 $0/$1, MD5 + RC4, collider #1 | Documents",
|
||||
" 9720 | MS Office <= 2003 $0/$1, MD5 + RC4, collider #2 | Documents",
|
||||
|
251
tools/test.pl
251
tools/test.pl
@ -61,7 +61,7 @@ my $hashcat = "./hashcat";
|
||||
|
||||
my $MAX_LEN = 55;
|
||||
|
||||
my @modes = (0, 10, 11, 12, 20, 21, 22, 23, 30, 40, 50, 60, 100, 101, 110, 111, 112, 120, 121, 122, 125, 130, 131, 132, 133, 140, 141, 150, 160, 200, 300, 400, 500, 600, 900, 1000, 1100, 1300, 1400, 1410, 1411, 1420, 1430, 1440, 1441, 1450, 1460, 1500, 1600, 1700, 1710, 1711, 1720, 1730, 1740, 1722, 1731, 1750, 1760, 1800, 2100, 2400, 2410, 2500, 2600, 2611, 2612, 2711, 2811, 3000, 3100, 3200, 3710, 3711, 3300, 3500, 3610, 3720, 3800, 3910, 4010, 4110, 4210, 4300, 4400, 4500, 4520, 4521, 4522, 4600, 4700, 4800, 4900, 5100, 5300, 5400, 5500, 5600, 5700, 5800, 6000, 6100, 6300, 6400, 6500, 6600, 6700, 6800, 6900, 7000, 7100, 7200, 7300, 7400, 7500, 7700, 7701, 7800, 7801, 7900, 8000, 8100, 8200, 8300, 8400, 8500, 8600, 8700, 8900, 9100, 9200, 9300, 9400, 9500, 9600, 9700, 9800, 9900, 10000, 10100, 10200, 10300, 10400, 10500, 10600, 10700, 10800, 10900, 11000, 11100, 11200, 11300, 11400, 11500, 11600, 11700, 11750, 11760, 11800, 11850, 11860, 11900, 12000, 12001, 12100, 12200, 12300, 12400, 12600, 12700, 12800, 12900, 13000, 13100, 13200, 13300, 13400, 13500, 13600, 13800, 13900, 14000, 14100, 14400, 14700, 14800, 14900, 15000, 15100, 15200, 15300, 15400, 15500, 15600, 15700, 15900, 16000, 16100, 16200, 16300, 16400, 16500, 16600, 16700, 16800, 16900, 17300, 17400, 17500, 17600, 17700, 17800, 17900, 18000, 18100, 18200, 99999);
|
||||
my @modes = (0, 10, 11, 12, 20, 21, 22, 23, 30, 40, 50, 60, 100, 101, 110, 111, 112, 120, 121, 122, 125, 130, 131, 132, 133, 140, 141, 150, 160, 200, 300, 400, 500, 600, 900, 1000, 1100, 1300, 1400, 1410, 1411, 1420, 1430, 1440, 1441, 1450, 1460, 1500, 1600, 1700, 1710, 1711, 1720, 1730, 1740, 1722, 1731, 1750, 1760, 1800, 2100, 2400, 2410, 2500, 2600, 2611, 2612, 2711, 2811, 3000, 3100, 3200, 3710, 3711, 3300, 3500, 3610, 3720, 3800, 3910, 4010, 4110, 4210, 4300, 4400, 4500, 4520, 4521, 4522, 4600, 4700, 4800, 4900, 5100, 5300, 5400, 5500, 5600, 5700, 5800, 6000, 6100, 6300, 6400, 6500, 6600, 6700, 6800, 6900, 7000, 7100, 7200, 7300, 7400, 7500, 7700, 7701, 7800, 7801, 7900, 8000, 8100, 8200, 8300, 8400, 8500, 8600, 8700, 8900, 9100, 9200, 9300, 9400, 9500, 9600, 9700, 9800, 9900, 10000, 10100, 10200, 10300, 10400, 10500, 10600, 10700, 10800, 10900, 11000, 11100, 11200, 11300, 11400, 11500, 11600, 11700, 11750, 11760, 11800, 11850, 11860, 11900, 12000, 12001, 12100, 12200, 12300, 12400, 12600, 12700, 12800, 12900, 13000, 13100, 13200, 13300, 13400, 13500, 13600, 13800, 13900, 14000, 14100, 14400, 14700, 14800, 14900, 15000, 15100, 15200, 15300, 15400, 15500, 15600, 15700, 15900, 16000, 16100, 16200, 16300, 16400, 16500, 16600, 16700, 16800, 16900, 17300, 17400, 17500, 17600, 17700, 17800, 17900, 18000, 18100, 18200, 18300, 99999);
|
||||
|
||||
my %is_utf16le = map { $_ => 1 } qw (30 40 130 131 132 133 140 141 1000 1100 1430 1440 1441 1730 1740 1731 5500 5600 8000 9400 9500 9600 9700 9800 11600 13500 13800);
|
||||
my %less_fifteen = map { $_ => 1 } qw (500 1600 1800 3200 6300 7400 10500 10700);
|
||||
@ -3030,6 +3030,42 @@ sub verify
|
||||
|
||||
next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in})));
|
||||
}
|
||||
# FileVault 2
|
||||
elsif ($mode == 18300)
|
||||
{
|
||||
($hash_in, $word) = split ":", $line;
|
||||
|
||||
next unless defined $hash_in;
|
||||
next unless defined $word;
|
||||
|
||||
my @data = split ('\$', $hash_in);
|
||||
|
||||
next unless scalar @data == 7;
|
||||
|
||||
shift @data;
|
||||
|
||||
my $signature = shift @data;
|
||||
|
||||
next unless ($signature eq 'fvde');
|
||||
|
||||
my $Z_PK = shift @data;
|
||||
|
||||
next unless ($Z_PK eq '2');
|
||||
|
||||
my $salt_length = shift @data;
|
||||
|
||||
next unless ($salt_length eq '16');
|
||||
|
||||
my ($ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOWRAPPEDKEY) = @data;
|
||||
|
||||
$salt = $ZCRYPTOSALT;
|
||||
$iter = $ZCRYPTOITERATIONCOUNT;
|
||||
|
||||
$param = $Z_PK;
|
||||
$param2 = $ZCRYPTOWRAPPEDKEY;
|
||||
|
||||
next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in})));
|
||||
}
|
||||
else
|
||||
{
|
||||
print "ERROR: hash mode is not supported\n";
|
||||
@ -3509,6 +3545,14 @@ sub verify
|
||||
|
||||
return unless (substr ($line, 0, $len) eq $hash_out);
|
||||
}
|
||||
elsif ($mode == 18300)
|
||||
{
|
||||
$hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2);
|
||||
|
||||
$len = length $hash_out;
|
||||
|
||||
return unless (substr ($line, 0, $len) eq $hash_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
$hash_out = gen_hash ($mode, $word, $salt, $iter);
|
||||
@ -4100,6 +4144,10 @@ sub passthrough
|
||||
|
||||
$tmp_hash = gen_hash ($mode, $word_buf, $salt_buf);
|
||||
}
|
||||
elsif ($mode == 18300)
|
||||
{
|
||||
$tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32));
|
||||
}
|
||||
else
|
||||
{
|
||||
print "ERROR: Unsupported hash type\n";
|
||||
@ -5246,6 +5294,20 @@ sub single
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($mode == 18300)
|
||||
{
|
||||
for (my $i = 1; $i < 32; $i++)
|
||||
{
|
||||
if ($len != 0)
|
||||
{
|
||||
rnd ($mode, $len, 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
rnd ($mode, $i, 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10217,6 +10279,193 @@ END_CODE
|
||||
|
||||
$tmp_hash = sprintf ('$krb5asrep$23$%s:%s$%s', $user_principal_name, unpack ("H*", $checksum), unpack ("H*", $edata2));
|
||||
}
|
||||
elsif ($mode == 18300)
|
||||
{
|
||||
my $salt_bin = pack ("H*", $salt_buf);
|
||||
|
||||
my $iterations = 20000;
|
||||
|
||||
if (defined ($iter))
|
||||
{
|
||||
$iterations = $iter;
|
||||
}
|
||||
|
||||
my $Z_PK = 2;
|
||||
|
||||
if (defined $additional_param)
|
||||
{
|
||||
$Z_PK = $additional_param;
|
||||
}
|
||||
|
||||
my $pbkdf2 = Crypt::PBKDF2->new
|
||||
(
|
||||
hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256),
|
||||
iterations => $iterations,
|
||||
output_len => 32,
|
||||
);
|
||||
|
||||
my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word_buf);
|
||||
|
||||
my $aes = Crypt::Mode::ECB->new ('AES', 0);
|
||||
|
||||
my $blob_bin;
|
||||
|
||||
my $A;
|
||||
my $B;
|
||||
my $P1;
|
||||
my $P2;
|
||||
my $P3;
|
||||
my $P4;
|
||||
|
||||
if (defined $additional_param2)
|
||||
{
|
||||
$blob_bin = pack ("H*", $additional_param2);
|
||||
|
||||
$A = substr ($blob_bin, 0, 8);
|
||||
$P1 = substr ($blob_bin, 8, 8);
|
||||
$P2 = substr ($blob_bin, 16, 8);
|
||||
$P3 = substr ($blob_bin, 24, 8);
|
||||
$P4 = substr ($blob_bin, 32, 8);
|
||||
|
||||
for (my $j = 5; $j >= 0; $j--)
|
||||
{
|
||||
# N = 4
|
||||
|
||||
$B = $A;
|
||||
$B ^= pack ("Q>", (4 * $j + 4));
|
||||
$B .= $P4;
|
||||
$B = $aes->decrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$P4 = substr ($B, 8, 8);
|
||||
|
||||
# N = 3
|
||||
|
||||
$B = $A;
|
||||
$B ^= pack ("Q>", (4 * $j + 3));
|
||||
$B .= $P3;
|
||||
$B = $aes->decrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$P3 = substr ($B, 8, 8);
|
||||
|
||||
# N = 2
|
||||
|
||||
$B = $A;
|
||||
$B ^= pack ("Q>", (4 * $j + 2));
|
||||
$B .= $P2;
|
||||
$B = $aes->decrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$P2 = substr ($B, 8, 8);
|
||||
|
||||
# N = 1
|
||||
|
||||
$B = $A;
|
||||
$B ^= pack ("Q>", (4 * $j + 1));
|
||||
$B .= $P1;
|
||||
$B = $aes->decrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$P1 = substr ($B, 8, 8);
|
||||
}
|
||||
|
||||
if ($A eq "\xa6" x 8)
|
||||
{
|
||||
for (my $j = 0; $j <= 5; $j++)
|
||||
{
|
||||
# N = 1
|
||||
|
||||
$B = $A;
|
||||
$B .= $P1;
|
||||
$B = $aes->encrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$A ^= pack ("Q>", (4 * $j + 1));
|
||||
$P1 = substr ($B, 8, 8);
|
||||
|
||||
# N = 2
|
||||
|
||||
$B = $A;
|
||||
$B .= $P2;
|
||||
$B = $aes->encrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$A ^= pack ("Q>", (4 * $j + 2));
|
||||
$P2 = substr ($B, 8, 8);
|
||||
|
||||
# N = 3
|
||||
|
||||
$B = $A;
|
||||
$B .= $P3;
|
||||
$B = $aes->encrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$A ^= pack ("Q>", (4 * $j + 3));
|
||||
$P3 = substr ($B, 8, 8);
|
||||
|
||||
# N = 4
|
||||
|
||||
$B = $A;
|
||||
$B .= $P4;
|
||||
$B = $aes->encrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$A ^= pack ("Q>", (4 * $j + 4));
|
||||
$P4 = substr ($B, 8, 8);
|
||||
}
|
||||
|
||||
$blob_bin = $A . $P1 . $P2 . $P3 . $P4;
|
||||
}
|
||||
else
|
||||
{
|
||||
$blob_bin = "\xff" x 40;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$A = "\xa6" x 8;
|
||||
$P1 = "\xff" x 8;
|
||||
$P2 = "\xff" x 8;
|
||||
$P3 = "\xff" x 8;
|
||||
$P4 = "\xff" x 8;
|
||||
|
||||
for (my $j = 0; $j <= 5; $j++)
|
||||
{
|
||||
# N = 1
|
||||
|
||||
$B = $A;
|
||||
$B .= $P1;
|
||||
$B = $aes->encrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$A ^= pack ("Q>", (4 * $j + 1));
|
||||
$P1 = substr ($B, 8, 8);
|
||||
|
||||
# N = 2
|
||||
|
||||
$B = $A;
|
||||
$B .= $P2;
|
||||
$B = $aes->encrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$A ^= pack ("Q>", (4 * $j + 2));
|
||||
$P2 = substr ($B, 8, 8);
|
||||
|
||||
# N = 3
|
||||
|
||||
$B = $A;
|
||||
$B .= $P3;
|
||||
$B = $aes->encrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$A ^= pack ("Q>", (4 * $j + 3));
|
||||
$P3 = substr ($B, 8, 8);
|
||||
|
||||
# N = 4
|
||||
|
||||
$B = $A;
|
||||
$B .= $P4;
|
||||
$B = $aes->encrypt ($B, $KEK);
|
||||
$A = substr ($B, 0, 8);
|
||||
$A ^= pack ("Q>", (4 * $j + 4));
|
||||
$P4 = substr ($B, 8, 8);
|
||||
}
|
||||
|
||||
$blob_bin = $A . $P1 . $P2 . $P3 . $P4;
|
||||
}
|
||||
|
||||
$tmp_hash = sprintf ('$fvde$%d$%d$%s$%d$%s', $Z_PK, length ($salt_bin), unpack ("H*", $salt_bin), $iterations, unpack ("H*", $blob_bin));
|
||||
}
|
||||
elsif ($mode == 99999)
|
||||
{
|
||||
$tmp_hash = sprintf ("%s", $word_buf);
|
||||
|
@ -9,7 +9,7 @@ TDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# missing hash types: 5200,6251,6261,6271,6281
|
||||
|
||||
HASH_TYPES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 125 130 131 132 133 140 141 150 160 200 300 400 500 600 900 1000 1100 1300 1400 1410 1411 1420 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7701 7800 7801 7900 8000 8100 8200 8300 8400 8500 8600 8700 8900 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11750 11760 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13711 13712 13713 13721 13722 13723 13731 13732 13733 13751 13752 13753 13771 13772 13773 13800 13900 14000 14100 14400 14600 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 99999"
|
||||
HASH_TYPES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 125 130 131 132 133 140 141 150 160 200 300 400 500 600 900 1000 1100 1300 1400 1410 1411 1420 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7701 7800 7801 7900 8000 8100 8200 8300 8400 8500 8600 8700 8900 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11750 11760 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13711 13712 13713 13721 13722 13723 13731 13732 13733 13751 13752 13753 13771 13772 13773 13800 13900 14000 14100 14400 14600 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 18300 99999"
|
||||
|
||||
#ATTACK_MODES="0 1 3 6 7"
|
||||
ATTACK_MODES="0 1 3 7"
|
||||
|
Loading…
Reference in New Issue
Block a user