Thoughts on BTC Mini Key Generator Security

19 replies 412 views
atlas2011Member
Posts: 8 · Reputation: 81
#1May 14, 2018, 08:27 PM
Hey everyone Can I get your thoughts on any security issues with https://github.com/raritycheck/BTCMiniKeyGenerator? We’re looking to use it for creating BTC mini private keys for some projects. Just want solid feedback.
4 Reply Quote Share
whale420Senior Member
Posts: 296 · Reputation: 853
#2May 15, 2018, 12:34 AM
Interesting tool, but why’s it requiring PortAudio? What’s that got to do with generating mini keys? Is this mini key like a mini private key? Will it work with Electrum? Don’t wanna install random software on my PC. Maybe clarify how this whole thing works.
4 Reply Quote Share
atlas2011Member
Posts: 8 · Reputation: 81
#3May 15, 2018, 01:04 PM
Good questions PortAudio helps by adding randomness through audio. Yep, the mini keys are fine for Electrum, we’ve generated over a thousand keys with it. But it’s not a standalone program, just a Python script.
1 Reply Quote Share
the_satNewbie
Posts: 102 · Reputation: 6
#4May 17, 2018, 12:02 AM
Open source is cool but is this entropy really reliable? I see you’re using secrets.token_bytes() and mixing it with audio and system time. Do you think the mini key is cryptographically secure?
1 Reply Quote Share
0xChadNewbie
Posts: 186 · Reputation: 3
#5May 17, 2018, 12:14 AM
with randomness, I’d say it’s pretty secure since it combines uRandom and audio-based randomness. Plus, there’s timing entropy involved too. For the mini private key, it takes a 29-character segment from the base58 entropy and appends 'S' at the start, which isn’t terrible considering there’s no real standard for these keys. But I’d like to see a modern update with a compressed pubKey for SegWit compatibility.
1 Reply Quote Share
atlas2011Member
Posts: 8 · Reputation: 81
#6May 17, 2018, 01:24 AM
Thanks for the info This tool focuses on mini keys, which we need for secure collectibles. We’re also thinking about a WIF tool.
2 Reply Quote Share
gang2015Member
Posts: 269 · Reputation: 62
#7May 17, 2018, 05:35 AM
Most folks here aren't developers, so don’t expect deep insights. Just my two cents: 1. What happens without audio input? Weird data or error? 2. How about adding tests to the code? 3. Using audio, os.urandom, and secrets seems safe enough.
3 Reply Quote Share
qu4ntumdiamondFull Member
Posts: 18 · Reputation: 707
#8May 17, 2018, 08:33 AM
If the audio input fails, the program crashes, but the private key won’t be generated. It’s meant to pull randomness from the user’s audio. Just saying, I wouldn’t trust this for keys with real value. Mini keys have less entropy, plus they start with '0', which reduces randomness even further.
0 Reply Quote Share
atlas2011Member
Posts: 8 · Reputation: 81
#9May 17, 2018, 08:48 AM
Thanks for your input Quickseller We’ve been through a bad RNG attack before, trusted some software and lost keys. Trying to refund everyone affected. We want to build something more secure. The audio helps with randomness, but we’re open to suggestions.
4 Reply Quote Share
0xChadNewbie
Posts: 186 · Reputation: 3
#10May 17, 2018, 12:15 PM
It’d be good to mention that software for comparison. The script makes 256-bit entropy, but a lot gets discarded for the mini private key, which lowers security to about 2^168. That’s still decent, but wait for more reviews before using it for actual bitcoin storage.
3 Reply Quote Share
atlas2011Member
Posts: 8 · Reputation: 81
#11May 17, 2018, 01:52 PM
Good point. Since it's a mini key, is it possible to use a full 256 bits?
4 Reply Quote Share
0xChadNewbie
Posts: 186 · Reputation: 3
#12May 17, 2018, 04:20 PM
Nah, the current standard limits it to 30 base58 characters, starting with 'S'. Even if you could use 256-bit entropy, security wouldn’t reach 2^256. An attacker could just target the mini private key itself.
4 Reply Quote Share
gang2015Member
Posts: 269 · Reputation: 62
#13May 17, 2018, 07:33 PM
Wait, so it's less about the mini keys and more about poor entropy?
2 Reply Quote Share
atlas2011Member
Posts: 8 · Reputation: 81
#14May 17, 2018, 11:25 PM
Exactly, this is about compromised sites or malicious code. Just look at these threads: Vulnerabilities on bitcoinpaperwallet... avoid it. walletgenerator.net scam exposed.
2 Reply Quote Share
0xChadNewbie
Posts: 186 · Reputation: 3
#15May 18, 2018, 03:03 AM
Yeah, those sites have sketchy entropy or backdoors. Trust is hard to come by these days.
1 Reply Quote Share
atlas2011Member
Posts: 8 · Reputation: 81
#16May 18, 2018, 07:27 AM
Definitely. Bad entropy is a real issue. The attacker could replace the RNG with a deterministic one, making the keys predictable.
1 Reply Quote Share
gang2015Member
Posts: 269 · Reputation: 62
#17May 18, 2018, 09:49 AM
Is there a way to get this generator officially audited?
2 Reply Quote Share
atlas2011Member
Posts: 8 · Reputation: 81
#18May 20, 2018, 02:49 PM
Short answer, get a security audit.
4 Reply Quote Share
0xNodeMember
Posts: 307 · Reputation: 80
#19May 20, 2018, 05:11 PM
Who would do that?
2 Reply Quote Share
gang2015Member
Posts: 269 · Reputation: 62
#20May 20, 2018, 05:36 PM
Not really my area, but you usually have options: 1. Automated auditing service 2. Hire an auditor 3. Look for security firms that offer audits. Best to ask around in security communities or check how similar tools got audited. Just an example, WALLET.FAIL found flaws in hardware wallets.
3 Reply Quote Share

Related topics