multibit2john.py should try not to output a "hash" for wrong input
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Here are some assorted notes about multibit2john.py (and a bit about the corresponding format).
multibit2john.py was introduced by @kholia in #2548. There's an attached file with sample wallets in there. We do not have those in the john-samples repo yet - we need to add them to there.
There are 3 kinds of those wallets/keys supported:
-
$multibit$1are essentiallyopenssl encwith MD5 and AES-256. Indeed, the sample from btcrecover (btcrecover/btcrecover/test/test-wallets/multibit-wallet.key, which by the way we don't have injohn-samples) is crackable with passwordbtcr-test-passwordby bothmultibit2john.py+johnoropenssl2john.py+john(with the correspondingly different formats). However, the latter also produces a flood of false positives. Maybe there's room for improvement/unification based on this understanding. -
For almost any unidentified file format,
multibit2john.pyhappily produces a$multibit$2hash. The only sanity check is based on filename, and it does not stop the program even if the filename doesn't contain the expected substrings - it merely prints "Make sure that this is a MultiBit HD wallet!", which isn't even clearly worded as a warning. We ought to do better, but looking at 3 sample files in @kholia's archive referenced above (one of which is the same asbtcrecover/btcrecover/test/test-wallets/multibithd-v0.5.0/mbhd.wallet.aes) there doesn't appear to be a signature we could check for. The best idea I have is to require that the file size be a multiple of 16 (AES block size) and maybe that it's also in a reasonable range (the samples are all around 25K, but maybe that's a baseline size for nearly-empty wallet and it grows with use?) -
We use btcrecover-derived code for
$multibit$3, including a pre-generated protobuf parser inprotobuf/wallet_pb2.py. I wonder if we should sync this with upstream once in a while. This file is nowbtcrecover/bitcoinj_pb2.pyupstream, so we could take it from there and adopt the rename, too. Its content changed quite a bit, but that could be a result of its regeneration with newer compiler.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with multibit2john.py and the sample wallet paths mentioned in the issue, then compare its handling of the three wallet types and unidentified files. Check the referenced MultiBit and btcrecover samples; done means wrong input is rejected without emitting a hash, while supported wallet samples continue to produce usable output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, cryptography, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100