JKS KeyStore - Add support for cracking 'key passwords'#5960
JKS KeyStore - Add support for cracking 'key passwords'#5960kholia wants to merge 2 commits intobleeding-jumbofrom
Conversation
a28bbb7 to
af442a8
Compare
Note: This was done using `gpt-5.3-codex` CLI.
af442a8 to
8cbfe61
Compare
|
Thank you @kholia! I'm afraid I don't have time to seriously get into this and review it properly, but we certainly do want to merge your contribution anyway. You should probably submit the samples via a PR to https://github.com/openwall/john-samples Maybe @Borim7 @wdormann @frankenstein91 @floyd-fuh who commented on the referenced issues would like to take a look, test, and comment. |
|
I have tested your code with multiple keystore files:
So regular use cases works as intended, corner case empty keystore only with master password can be improved ;) Thanks for the work |
|
Awesome and exhaustive testing work @Borim7 - thank you! With the latest fixes: https://stackoverflow.com/questions/37994315/how-to-create-an-empty-java-trust-store describes how to create empty KeyStore(s). |
|
Sorry if I'm wrong, but I'm currently just on my phone, but: it looks to me like the implementation just attacks the private key password, while ignoring all the cracking speed improvements that were found. If I'm reading it correctly it xors the entire encrypted private key for each password attempt, which is unnecessary. This is still a huge improvement: john will never attempt to crack a password that does not protect any data. Yes, jks is so old that they thought creating a "password" (the keystore password) that is used to calculate a hash to proof that the keystore was not corrupted by byte flips so just integrity protection is a good idea. Public keys are always cleartext in there. Private keys are protected by a password that might or might not be the same as for the integrity protection. However, it's only necessary for a cracking step to calculate a sha1 over 20 bytes plus the password. It looks like this code shoves the entire encrypted private key in the sha1 calculation, is that correct? So either I haven't read the code correctly or hashcat will still be much much faster. |
|
The base implementation can go in first (once reviewed and found to be working) and then you can add your optimization patch. |
|
John works now for all my test files.Thanks |
|
GPU testing: All good! |
Note: This was done using
gpt-5.3-codexCLI.Side-note: I didn't have much luck with Gemini 3.x on this task.
Fixes: #5959, #2725, #3219
Samples:
KeyStore-Test.jks.txt
KeyStore.jks.txt
Passwords: