mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-14 09:40:59 +00:00
CRC32: Prevent decompression of data used in CRC32 calculation on host. This leads to false negatives with TrueCrypt/VeraCrypt keyfiles
This commit is contained in:
parent
e79a2aa90c
commit
f54643479d
@ -29,6 +29,7 @@
|
|||||||
- UTF8-to-UTF16: Replaced naive UTF8 to UTF16 conversion with true conversion for RAR3, AES Crypt, MultiBit HD (scrypt) and Umbraco HMAC-SHA1
|
- UTF8-to-UTF16: Replaced naive UTF8 to UTF16 conversion with true conversion for RAR3, AES Crypt, MultiBit HD (scrypt) and Umbraco HMAC-SHA1
|
||||||
- AES Crypt Plugin: Reduced max password length from 256 to 128 which improved performance by 22%
|
- AES Crypt Plugin: Reduced max password length from 256 to 128 which improved performance by 22%
|
||||||
- RAR3-p (Compressed): Fix workaround in unrar library in AES constant table generation to enable multi-threading support
|
- RAR3-p (Compressed): Fix workaround in unrar library in AES constant table generation to enable multi-threading support
|
||||||
|
- CRC32: Prevent decompression of data used in CRC32 calculation on host. This leads to false negatives with TrueCrypt/VeraCrypt keyfiles
|
||||||
|
|
||||||
##
|
##
|
||||||
## Technical
|
## Technical
|
||||||
|
@ -16,6 +16,7 @@ int _wopen (const char *path, int oflag, ...);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool hc_fopen (HCFILE *fp, const char *path, char *mode);
|
bool hc_fopen (HCFILE *fp, const char *path, char *mode);
|
||||||
|
bool hc_fopen_nozip (HCFILE *fp, const char *path, char *mode);
|
||||||
int hc_fscanf (HCFILE *fp, const char *format, void *ptr);
|
int hc_fscanf (HCFILE *fp, const char *format, void *ptr);
|
||||||
int hc_fprintf (HCFILE *fp, const char *format, ...);
|
int hc_fprintf (HCFILE *fp, const char *format, ...);
|
||||||
int hc_vfprintf (HCFILE *fp, const char *format, va_list ap);
|
int hc_vfprintf (HCFILE *fp, const char *format, va_list ap);
|
||||||
|
@ -94,7 +94,7 @@ int cpu_crc32 (const char *filename, u8 keytab[64])
|
|||||||
|
|
||||||
HCFILE fp;
|
HCFILE fp;
|
||||||
|
|
||||||
hc_fopen (&fp, filename, "rb");
|
hc_fopen_nozip (&fp, filename, "rb");
|
||||||
|
|
||||||
#define MAX_KEY_SIZE (1024 * 1024)
|
#define MAX_KEY_SIZE (1024 * 1024)
|
||||||
|
|
||||||
|
@ -113,6 +113,68 @@ bool hc_fopen (HCFILE *fp, const char *path, char *mode)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hc_fopen_nozip (HCFILE *fp, const char *path, char *mode)
|
||||||
|
{
|
||||||
|
if (path == NULL || mode == NULL) return false;
|
||||||
|
|
||||||
|
int oflag = -1;
|
||||||
|
|
||||||
|
int fmode = S_IRUSR|S_IWUSR;
|
||||||
|
|
||||||
|
if (strncmp (mode, "a", 1) == 0 || strncmp (mode, "ab", 2) == 0)
|
||||||
|
{
|
||||||
|
oflag = O_WRONLY | O_CREAT | O_APPEND;
|
||||||
|
|
||||||
|
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
|
||||||
|
if (strncmp (mode, "ab", 2) == 0) oflag |= O_BINARY;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (strncmp (mode, "r", 1) == 0 || strncmp (mode, "rb", 2) == 0)
|
||||||
|
{
|
||||||
|
oflag = O_RDONLY;
|
||||||
|
fmode = -1;
|
||||||
|
|
||||||
|
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
|
||||||
|
if (strncmp (mode, "rb", 2) == 0) oflag |= O_BINARY;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (strncmp (mode, "w", 1) == 0 || strncmp (mode, "wb", 2) == 0)
|
||||||
|
{
|
||||||
|
oflag = O_WRONLY | O_CREAT | O_TRUNC;
|
||||||
|
|
||||||
|
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
|
||||||
|
if (strncmp (mode, "wb", 2) == 0) oflag |= O_BINARY;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ADD more strncmp to handle more "mode"
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fp->pfp = NULL;
|
||||||
|
fp->is_gzip = false;
|
||||||
|
fp->is_zip = false;
|
||||||
|
|
||||||
|
if (fmode == -1)
|
||||||
|
{
|
||||||
|
fp->fd = open (path, oflag);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fp->fd = open (path, oflag, fmode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fp->fd == -1 && fp->is_zip == false) return false;
|
||||||
|
|
||||||
|
if ((fp->pfp = fdopen (fp->fd, mode)) == NULL) return false;
|
||||||
|
|
||||||
|
fp->path = path;
|
||||||
|
fp->mode = mode;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
|
size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
|
||||||
{
|
{
|
||||||
size_t n = -1;
|
size_t n = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user