-
-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Summary:
The Shamir Secret Sharing Scheme implementation used in the official Bitaps Bug Bounty Challenge (https://bitaps.com/mnemonic/challenge) generates polynomial coefficients in a biased (non-uniform) manner over GF(256). This flaw reduces the effective entropy of the secret and enables practical statistical attacks using fewer shares than the declared threshold. The challenge specifically publishes only 2 out of 3 required shares (threshold 3-of-5), making this vulnerability directly exploitable against the live 1 BTC bounty. The same issue was previously referenced in issue #23 but remains unpatched in the code linked from the bounty page.
Affected Code:
The vulnerable logic is located in the official repositories referenced on the challenge page: https://github.com/bitaps-com/pybtc/blob/master/pybtc/functions/shamir.py (lines ~89–110)
https://github.com/bitaps-com/jsbtc/blob/master/src/functions/shamir_secret_sharing.js (equivalent section)
Relevant excerpt (Python version):
for i in range(threshold - 1):
if e_i < len(e):
a = e[e_i]
e_i += 1
else:
e = generate_entropy(hex=False)
a = e[0]
e_i = 1
q.append(a)
The underlying generate_entropy() function (and earlier versions using modular multiplication) does not produce a uniform distribution across all 256 possible field elements. Values near 255 are underrepresented, resulting in measurable statistical bias in the quadratic coefficient a₂.
Impact on the Challenge:
Threshold: 3 (degree-2 polynomial)
Only 2 shares published
The bias in a₂ significantly reduces the search space for the original 128-bit mnemonic
This directly contradicts the security claim that “any three shares are sufficient and fewer are mathematically impossible”
The 1 BTC reward address (bc1qyjwa0tf0en4x09magpuwmt2smpsrlaxwn85lh6) remains unspent since August 2021, confirming that the vulnerable implementation is still in production use for the bounty.
Bounty Classification:
This falls under the 0.1 BTC category stated on the challenge page: “0.1 BTC – Any bug in the implementation of the presented secret sharing scheme that can lead to loss of access and the inability to recover the original mnemonic phrase.”
Next Steps OfferedI am prepared to provide immediately: Full statistical analysis of the coefficient bias (with entropy measurements)
Proof-of-Concept script demonstrating the reduced search space
Optimized attack combining degree-drop analysis with probability ranking using the two published shares.
Reward Address 12QmzvUKqNcrXYvXw7oLywyfp9gTFgbNLJ