this case occurs with probability $\approx \frac{1}{ 2^{128} }$
ecrecover(e, v, r, s) accepts any e, 27/28 for v and r, s in [1, Secp256k1.N), where N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
suppose public key has pubKey.x >= N and in that case ecrecover will return address(0). so the protocol can't verify the signature. which means you lose control of the smart contract.
|
// Set r = Pₓ |
|
uint r = pubKey.x; |
r, s range:
fix: if (!(pubKey.isOnCurve() && pubKey.x < LibSecp256k1.Q())) {
also need to reject pubKey.x >= Secp256k1.N for group public key on backend and at constructor?
|
if (!pubKey.isOnCurve()) { |
|
return false; |
|
} |
this case occurs with probability$\approx \frac{1}{ 2^{128} }$
ecrecover(e, v, r, s)accepts anye,27/28forvandr,sin[1, Secp256k1.N), whereN = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141suppose public key has
pubKey.x >= Nand in that caseecrecoverwill returnaddress(0). so the protocol can't verify the signature. which means you lose control of the smart contract.scribe/src/libs/LibSchnorr.sol
Lines 81 to 82 in 7d2106a
r,srange:fix:
if (!(pubKey.isOnCurve() && pubKey.x < LibSecp256k1.Q())) {also need to reject
pubKey.x >= Secp256k1.Nfor group public key on backend and at constructor?scribe/src/libs/LibSchnorr.sol
Lines 36 to 38 in 7d2106a