ZIP formats: Honor 64-bit data length#5715
ZIP formats: Honor 64-bit data length#5715magnumripper merged 2 commits intoopenwall:bleeding-jumbofrom
Conversation
solardiz
left a comment
There was a problem hiding this comment.
I was worried we could be introducing performance impact for other uses of the HMAC - but probably not since it'd get inlined and the compiler would see that the actually passed value is a uint? Still, have you run any benchmarks or looked at kernel binary size changes or register number changes in builds of other kernels that use this HMAC?
solardiz
left a comment
There was a problem hiding this comment.
Oh, this is not so easy at all. hmac_sha1 passes data_len into SHA1_Update, which currently also only accepts a uint. And there's the USE_DATA_BUF code version which also has uint blocks.
|
Back to the drawing board |
|
So I fixed the opencl_sha1_ctx.h as well. Tests on nvidia, compared to current bleeding: ZIP itself: Binary size grew with 289 bytes. Kernel used one (1) more register. Performance varies a bit but probably didn't change. DMG uses the HMAC-SHA1. Binary size grew from 1577956 to 1671130 (!?). A stack frame grew from 9360 to 9376 bytes but other than that I see no difference in ptxas output. Performance didn't change. GPG uses only the affected SHA1-CTX. Binary size grew from 1340541 to 1434672 (!?). The kernel uses one (1) more register. Performance didn't change. Those sizes growing with 100KB are puzzling. Next is to create a test archive and see if this is worthwhile at all. EDIT: Also, no warnings or problems with an all-formats test. |
That was harder than expected, I thought I could do it with 7z but apparently it can only produce pkzip archives. I'll see if I can find some Windows luser willing to produce a sample file for me. |
4081af6 to
8492346
Compare
Looks like I managed to create such a file using Ubuntu (if I've understood all the requirements), but john itself can't load the file (it is too much to my poor hardware): $ head -c 128 teste.hash
myfile.zip/myfile:$zip2$*0*3*0*96e664ad0e2d714ea7246303831fd088*3f4e*14018fd26*4ddf34229f02c2760fe80f89727fd2beb0af378ea06eaa3c9
$ john teste.hash
Morto # ==> (it means killed, I guess)
$ file myfile.zip
myfile.zip: Zip archive data, at least v4.5 to extract, compression method=AES EncryptedEven after allocating 17 G (VIRT field from |
Thanks! From the look of it I'd suspect the OOM killer got you. How did you create the file? |
Straightforward. Using the Nautilus GUI. head -c 5G </dev/urandom >myfile
# GUI, right click, ...
# 2john |
|
The OpenCL format, with this fix, works. Curiously enough the CPU format doesn't but that's a separate issue. |
To avoid this, how about we use the same approach as we use with |
8492346 to
33598da
Compare
This includes adding 64-bit length support to shared HMAC-SHA1 and in turn the CTX version of SHA1. Closes openwall#5712
This was the only thing needed to get the ZIP CPU format to crack huge archives - the format code was already correct. Closes openwall#5728
33598da to
e1fd339
Compare
Good idea, did that. I also added support for 64-bit length in CPU side shared HMAC_SHA1 and HMAC_SHA-2. That shouldn't lead to any problem or performance regression but I did an all-formats Both ZIP formats now crack a real > 4GB archive. This is ready to review. |
There may be a performance regression in 32-bit builds, but I guess that's fine these days. Or we could use |
I'd rather change it to just |
Apparently I'm actually running libcrypto. That is openssl, right? Why do we have sph_sha1.h at all? |
BTW the underlying SHA1, whichever one we use, likely has it as 64-bit anyway - at least until we implement our own scalar SHA1 for CPU (I thought we had one). So I doubt there can be any measurable performance regression. |
I agree,
There's some preprocessor magic to define #define RFUN sha1_round
#define HASH sha1
#define BE32 1
#include "md_helper.c" |
Recent commit had it as uint64_t. This change means 32-bit hosts won't support ZIP files of 4 GiB or larger. They will be rejected with a warning with hints to use a 64-bit build or the zip-opencl format for loading them. See openwall#5715
Recent commit had it as uint64_t. This change means 32-bit hosts won't support ZIP files of 4 GiB or larger. They will be rejected with a warning, hinting to use a 64-bit build or the zip-opencl format for loading them. See openwall#5715
Recent commit had it as uint64_t. See openwall#5715
Recent commit had it as uint64_t. See #5715
This includes changing shared OpenCL HMAC-SHA1 to support this.
Closes #5712