-
Notifications
You must be signed in to change notification settings - Fork 2.4k
KWallet format: Support new partially-endianness-unbroken wallets, proper valid(), tunable costs, fix old KDF, support/produce truncated "hashes" #5869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Describe in one term how bizarre a file format can be. "partially-endianness-unbroken" 😅 Awesome, the patch seems to work and I'm able to crack the wallets. 👍 |
|
Thank you @exploide! I'd merge this now, but I'm also thinking of possibly not decrypting beyond the first 64 bytes (8+4+52) when we're not checking SHA-1 anyway, for some slight speedup. Maybe I should implement that. |
This is now implemented. |
ecb7055 to
ca20af9
Compare
|
This format's I guess our fuzzing just didn't test 64K+, maybe it should, @AlekseyCherepanov. |
Fixed with a commit in this PR now.
Or rather, maybe it's hard for a fuzzer to simultaneously update a length field and the following data to be of the exact updated length. So maybe we should implement this as a special case in the fuzzer. |
|
We just got the familiar ASan false positive for Argon2 here, in the https://github.com/openwall/john/actions/runs/18964974991/job/54159710415?pr=5869 |
6f4720b to
aa2ea03
Compare
These are from sample files generated by exploide.
These are from sample files generated by exploide. Fixes openwall#5874
|
@exploide This passes all of my tests with the sample wallets you provided, but you could want to retest before I merge. The new code in John is supposed to work with "hashes" produced by both old and new kwallet2john, and even recognize that they're effectively the same (for the purposes of duplicate detection and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, these are a lot of improvements and fixes to the format 👍
I tested again and everything seems to work as I would expect it.
Just added two minor notes concerning code comments. But is also fine as is.
|
|
||
| # Don't reveal most of the actual content. We only need 64 bytes, but | ||
| # truncate at 65 to avoid false auto-detection as the "leet" format. | ||
| # Comment out the below line if you need a "hash" for an older version of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if using an older version of JtR would be an option given that there were a lot of cases which did not work at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Maybe I should add a warning to this comment, or drop the suggestion to comment-out for the old version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just revised the comment and force-pushed.
| alter_endianity(buffer, sizeof(buffer)); | ||
|
|
||
| /* | ||
| * Potential optimization: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the optimization you implemented? The comment sounds a bit hypothetical. But maybe I'm mistaken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented the most important part of this optimization. The comment remains valid as-is, but the meaning of "the whole thing" changes from "full original encrypted file" to "full data still included in our truncated non-hashes". It is still possible to optimize further, by decrypting just 8 rather than 56 bytes most of the time.
Thank you very much @exploide for supporting me in this effort. I'm going to merge this now and move on to other tasks. |
Fixes #5866 (edit: and #5874)
In my testing, this cracks all samples from our john-samples repo as well as those attached to #5866.