openwall / john

John the Ripper jumbo - advanced offline password cracker, which supports hundreds of hash and cipher types, and runs on many operating systems, CPUs, GPUs, and even some FPGAs
https://www.openwall.com/john/
Other
10.36k stars 2.11k forks source link

Argon2-opencl crashes with insanely costly hashes #5568

Closed magnumripper closed 2 weeks ago

magnumripper commented 2 weeks ago

These mockup (uncrackable) hashes mimic default settings from KeePassXC:

$argon2d$v=19$m=67108864,t=30,p=2$ZGFtYWdlX2RvbmU$w9w3s5/zV8+PcAZlJhnTCOE+vBkZssmZf6jOq3dKv50
$argon2id$v=19$m=67108864,t=30,p=2$U2FMdHNBbFQ$Djwdq8LGcBSmvJAX8TPqELq0N8YVHEdk5bWb4tRy70k

Trying them out on a 2080ti:

Device 1: NVIDIA GeForce RTX 2080 Ti
Loaded 2 password hashes with 2 different salts (argon2-opencl [Blake2 OpenCL])
Cost 1 (t) is 30 for all loaded hashes
Cost 2 (m) is 67108864 for all loaded hashes
Cost 3 (p) is 2 for all loaded hashes
Loaded hashes with cost 4 (type [0:Argon2d 1:Argon2i 2:Argon2id]) varying from 0 to 2
0: OpenCL CL_INVALID_BUFFER_SIZE (-61) error in opencl_argon2_fmt_plug.c:613 - Error creating memory buffer
solardiz commented 2 weeks ago

@magnumripper Can you test on super's GPUs? Per my previous testing, I guess this will just work there. I never tried a t this high, but it shouldn't affect memory allocation.

And we definitely need to get it to work on your 2080Ti as well. This is unexpected.

magnumripper commented 2 weeks ago

Same problem, both with AMD and nvidia. Did I somehow format the hashes incorrectly? Oh, I see now. Keepass writes it as 67108864 but here it should say 65536

magnumripper commented 2 weeks ago

That was it.

gfx900 [Radeon RX Vega] 16.99c/s GeForce GTX 1080 38.34c/s GeForce RTX 2080 Ti 87.88c/s

$argon2d$v=19$m=65536,t=30,p=2$ZGFtYWdlX2RvbmU$w9w3s5/zV8+PcAZlJhnTCOE+vBkZssmZf6jOq3dKv50
$argon2id$v=19$m=65536,t=30,p=2$U2FMdHNBbFQ$Djwdq8LGcBSmvJAX8TPqELq0N8YVHEdk5bWb4tRy70k
Cost 1 (t) is 30 for all loaded hashes
Cost 2 (m) is 65536 for all loaded hashes
Cost 3 (p) is 2 for all loaded hashes
Loaded hashes with cost 4 (type [0:Argon2d 1:Argon2i 2:Argon2id]) varying from 0 to 2
solardiz commented 2 weeks ago

Trying to compute 272 hashes at a time using 4352 of 10820 MiB device memory

It's weird we were getting this far and with sane proposed memory usage. Do we maybe have an integer overflow before reaching this point when insane inputs are used? We may want to avoid integer overflows and report a proper error when not even a single hash would fit device memory. cc: @alainesp