mirror of
https://github.com/openwall/john.git
synced 2026-12-03 20:43:49 +07:00
[GH-ISSUE #2654] Electrum format fails to load large (huge) hashes #1722
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#1722
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @t4777sd on GitHub (Aug 5, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2654
Originally assigned to: @kholia on GitHub.
Steps to reproduce
I am testing the latest feature for electrum wallets. This appears to create a password hash line that contains the entire wallet file as part of the password hash line. Since wallet files can be quite large, it makes it so john will not load the hash.
I suspect there is some upper limit to the size of hashes and any hash over a certain length is ignored. I tested in on my wallet file which produces a password hash line that is 350KB and it fails to load the hash ("No password hashes loaded "). I tested it on a newly created wallet file which which created an 11KB password hash line and it worked.
System configuration
/opt/John/john --list=build-info
Version: 1.8.0-jumbo-1-5774-g8d7ccaf
Build: linux-gnu 64-bit AVX2-ac MPI + OMP
SIMD: AVX2, interleaving: MD4:3 MD5:3 SHA1:1 SHA256:1 SHA512:1
$JOHN is /opt/John/
Format interface version: 14
Max. number of reported tunable costs: 3
Rec file version: REC4
Charset file version: CHR3
CHARSET_MIN: 1 (0x01)
CHARSET_MAX: 255 (0xff)
CHARSET_LENGTH: 24
SALT_HASH_SIZE: 1048576
Max. Markov mode level: 400
Max. Markov mode password length: 30
gcc version: 5.4.0
GNU libc version: 2.23 (loaded: 2.23)
Crypto library: OpenSSL
OpenSSL library version: 01000207f
OpenSSL 1.0.2g 1 Mar 2016
GMP library version: 6.1.0
File locking: fcntl()
fseek(): fseek
ftell(): ftell
fopen(): fopen
memmem(): System's
@kholia commented on GitHub (Aug 6, 2017):
Currently, there is a limit of around 16 KB on the electrum hash size.
Can you post the steps you took to generate the 350 KB hash? How can I reproduce this problem locally? Which version of Electrum Bitcoin Wallet are you using?
I think https://github.com/gurnec/btcrecover will work better for such huge wallets.
Update:
I think that your wallet might be using the new Electrum 2.8+ encrypted format. In such cases, including almost all the wallet data in the hash is necessary with our current cracking method.
@kholia commented on GitHub (Aug 6, 2017):
After looking at
btcrecover, it seems that we could support such huge hashes in JtR but at the cost of generating false positives. I haven't experimented with this idea yet, so I don't know if the rate of false positives is reasonable.@t4777sd commented on GitHub (Aug 7, 2017):
Yes, I am using the new wallet format. Unfortunately, I am using keepass and I created an 8 char password to set the password and I closed keepass without saving the new password, so the password was lost once it left my clipboard. I tried btcrecover, but since it is a random 8 char password it is almost impossible due to memory usage of btcrecover and how slow it is.
If JtR could support the large hashes that electrum requires or another solution, then it would be great. False positives are better than nothing, in my case.
@kholia commented on GitHub (Aug 8, 2017):
I am not confident about recovering a random password of length 8 in a reasonable amount of time (e.g. three months).
With our current OpenCL code,
I think that the corresponding CPU format would be too slow to attack this problem.
@gurnec You might be interested in this topic I think, thanks!
@gurnec commented on GitHub (Aug 9, 2017):
From a feasibility point of view, I agree with @kholia - an Electrum 2.8 fully-encrypted wallet with an 8 char alphanumeric password would take on the order of years or tens of years to crack, even on fairly big iron.
btcrecover checks the full MAC, just like JtR, so I wouldn't expect any false positives.
But back on topic: if you look at these five bullet points, btcrecover uses the first, second, and last (the first and second just weed out some true negatives, the last is the full MAC check), and JtR currently uses the last.
The third bullet point is the thought I had for JtR if the lines in the hashes file had limited length and couldn't store the entire file. I created a Python proof of concept here to try this out (it tries bullet points one and three, and seems to work).
One problem is that it's difficult to reason about the false positive rate (I'm pretty sure there are no false negatives). It should at least as good as 1 in 251, possibly much lower with that final regex check, but with the zlib stuff in the way, it's hard for me to tell.
Of course since this particular wallet seems infeasible, I'm not sure how important implementing this in JtR would be....
@kholia commented on GitHub (Aug 10, 2017):
Thanks @gurnec.
I was planning on using only the first, and second checks for such large hashes. I think doing so will result in false positives.
The third check is very interesting! I will experiment with it to see if we can put a reasonable upper limit on the number of blocks to decrypt and decompress.
Thanks for the great ideas 👍
@gurnec commented on GitHub (Aug 10, 2017):
It definitely will, those two only "pin" 19 + 8 bits respectively, so that's a false positive rate as high as 1 in 227.
I went with 512 bytes as the comment said. Also just FYI, the test wallet I used (which is an empty wallet) only needed 80 bytes before it could be identified.
@t4777sd commented on GitHub (Aug 14, 2017):
Awesome, I hope that a solution makes it into JtR so I can try it. In my case, the password is all lowercase, so it will likely be recoverable if it can work in JtR. Even if it takes me 2 years to do it then it will be worth it considering the amount of coins I have lost in the wallet.
So I pray that this gets added to JtR.
@kholia commented on GitHub (Aug 16, 2017):
This issue should be fixed now.
However, I am not confident that the new code is 100% correct and will work for all cases. It does work for the sample data we have but there are no further guarantees.