mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-24 07:28:37 +00:00
avoid processing crc32 if the unpacked size is not the expected
This commit is contained in:
parent
c105104b92
commit
21a471139a
@ -44,6 +44,8 @@ typedef struct rar3_hook
|
||||
|
||||
u32 first_block_decrypted[4];
|
||||
|
||||
u32 unpack_failed;
|
||||
|
||||
u32 crc32;
|
||||
|
||||
} rar3_hook_t;
|
||||
@ -495,6 +497,8 @@ KERNEL_FQ void m23800_comp (KERN_ATTR_TMPS_HOOKS_ESALT (rar3_tmp_t, rar3_hook_t,
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
if (hooks[gid].unpack_failed == 1) return;
|
||||
|
||||
u32 crc32 = hooks[gid].crc32;
|
||||
|
||||
const u32 r0 = crc32;
|
||||
|
@ -42,6 +42,8 @@ typedef struct rar3_hook
|
||||
|
||||
u32 first_block_decrypted[4];
|
||||
|
||||
u32 unpack_failed;
|
||||
|
||||
u32 crc32;
|
||||
|
||||
} rar3_hook_t;
|
||||
@ -1096,6 +1098,8 @@ KERNEL_FQ void m23800_comp (KERN_ATTR_TMPS_HOOKS_ESALT (rar3_tmp_t, rar3_hook_t,
|
||||
|
||||
if (gid >= GID_CNT) return;
|
||||
|
||||
if (hooks[gid].unpack_failed == 1) return;
|
||||
|
||||
u32 crc32 = hooks[gid].crc32;
|
||||
|
||||
const u32 r0 = crc32;
|
||||
|
6
deps/unrar/hc_decompress_rar.cpp
vendored
6
deps/unrar/hc_decompress_rar.cpp
vendored
@ -12,7 +12,7 @@
|
||||
#define SOLID false
|
||||
#define METHOD VER_UNPACK // 29 for RAR3 archives
|
||||
|
||||
extern "C" unsigned int hc_decompress_rar (unsigned char *Win, unsigned char *Inp, unsigned char *VM, unsigned char *PPM, const unsigned int OutputSize, const unsigned char *Input, const unsigned int PackSize, const unsigned int UnpackSize, const unsigned char *Key, const unsigned char *IV)
|
||||
extern "C" unsigned int hc_decompress_rar (unsigned char *Win, unsigned char *Inp, unsigned char *VM, unsigned char *PPM, const unsigned int OutputSize, const unsigned char *Input, const unsigned int PackSize, const unsigned int UnpackSize, const unsigned char *Key, const unsigned char *IV, unsigned int *unpack_failed)
|
||||
{
|
||||
ComprDataIO DataIO;
|
||||
|
||||
@ -47,9 +47,7 @@ extern "C" unsigned int hc_decompress_rar (unsigned char *Win, unsigned char *In
|
||||
|
||||
Unp.DoUnpack (METHOD, SOLID); // sets output
|
||||
|
||||
unsigned int wfs = (unsigned int) Unp.GetWrittenFileSize();
|
||||
|
||||
if (wfs != UnpackSize) return 0;
|
||||
*unpack_failed = (Unp.WrittenFileSize != UnpackSize);
|
||||
|
||||
unsigned int crc32 = (unsigned int) DataIO.UnpHash.GetCRC32 ();
|
||||
|
||||
|
4
deps/unrar/unpack.hpp
vendored
4
deps/unrar/unpack.hpp
vendored
@ -279,7 +279,6 @@ class Unpack:PackDef
|
||||
bool Suspended;
|
||||
bool UnpAllBuf;
|
||||
bool UnpSomeRead;
|
||||
int64 WrittenFileSize;
|
||||
bool FileExtracted;
|
||||
|
||||
|
||||
@ -383,13 +382,14 @@ class Unpack:PackDef
|
||||
bool IsFileExtracted() {return(FileExtracted);}
|
||||
void SetDestSize(int64 DestSize) {DestUnpSize=DestSize;FileExtracted=false;}
|
||||
void SetSuspended(bool Suspended) {Unpack::Suspended=Suspended;}
|
||||
int64 GetWrittenFileSize() {return(WrittenFileSize);}
|
||||
|
||||
#ifdef RAR_SMP
|
||||
void SetThreads(uint Threads);
|
||||
void UnpackDecode(UnpackThreadData &D);
|
||||
#endif
|
||||
|
||||
int64 WrittenFileSize;
|
||||
|
||||
byte *hcwin;
|
||||
byte *hcppm;
|
||||
|
||||
|
@ -73,6 +73,8 @@ typedef struct rar3_hook
|
||||
|
||||
u32 first_block_decrypted[4];
|
||||
|
||||
u32 unpack_failed;
|
||||
|
||||
u32 crc32;
|
||||
|
||||
} rar3_hook_t;
|
||||
@ -286,7 +288,7 @@ bool module_hook_extra_param_term (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int hc_decompress_rar (unsigned char *Win, unsigned char *Inp, unsigned char *VM, unsigned char *PPM, const unsigned int OutputSize, const unsigned char *Input, const unsigned int PackSize, const unsigned int UnpackSize, const unsigned char *Key, const unsigned char *IV);
|
||||
unsigned int hc_decompress_rar (unsigned char *Win, unsigned char *Inp, unsigned char *VM, unsigned char *PPM, const unsigned int OutputSize, const unsigned char *Input, const unsigned int PackSize, const unsigned int UnpackSize, const unsigned char *Key, const unsigned char *IV, unsigned int *unpack_failed);
|
||||
|
||||
void module_hook23 (hc_device_param_t *device_param, const void *hook_extra_param, const void *hook_salts_buf, const u32 salt_pos, const u64 pw_pos)
|
||||
{
|
||||
@ -328,7 +330,9 @@ void module_hook23 (hc_device_param_t *device_param, const void *hook_extra_para
|
||||
const u8 *key = (u8 *) hook_item->key;
|
||||
const u8 *iv = (u8 *) hook_item->iv;
|
||||
|
||||
const u32 crc32 = hc_decompress_rar (rar3_hook_extra->win[device_param->device_id], rar3_hook_extra->inp[device_param->device_id], rar3_hook_extra->vm[device_param->device_id], rar3_hook_extra->ppm[device_param->device_id], unpack_size, data, pack_size, unpack_size, key, iv);
|
||||
hook_item->unpack_failed = 1;
|
||||
|
||||
const u32 crc32 = hc_decompress_rar (rar3_hook_extra->win[device_param->device_id], rar3_hook_extra->inp[device_param->device_id], rar3_hook_extra->vm[device_param->device_id], rar3_hook_extra->ppm[device_param->device_id], unpack_size, data, pack_size, unpack_size, key, iv, &hook_item->unpack_failed);
|
||||
|
||||
hook_item->crc32 = crc32;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user