-
-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insufficient BLS signature validation for lodestar+bls/herumi #2645
Comments
hi @dapplion, as per my analysis, bls/blst's validate is checking if the signature is a (G2) group point. bls/herumi is checking the order of the signature point w.r.t. G2 order (in signature constructor: isValidOrder ). will continue digging. |
@g11tech Can you try to validate this test vector? export const POINT_NOT_IN_G2 = Buffer.from(
"8123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"hex"
); |
this point fails sigValidate of bls/blst but passes isValidOrder of bls/herumi, which i guess is only checking the order of the point and not its group membership (of G2). On further digging bls/herumi uses "bls-eth-wasm" under the hood to wrap the bls functionality in webassembley. however its signature class doesn't export any group validation method, just the order validation: https://github.com/herumi/bls-eth-wasm/blob/master/src/bls.js#L550-L580 I will further keep digging through. |
From Antonio's messages: this is how prysm used to do [group verification] (when they had support for herumi) https://github.com/prysmaticlabs/prysm/blob/develop/shared/bls/herumi/init.go#L13 |
thanks @g11tech . |
for bls/herumi this param is not even used and its signature deserialize request from the provided data itself fails (on updated bls-eth-wasm 0.4.8 which chainsafe/bls package uses) so it seems its always being validated inside the wasm module in the updated version: in previous bls-eth-wasm version of 0.4.4 this call was success returning the signature. |
well this is nice from the security point of view but it might break the semantic of the method (what if you pass |
unfortunately herumi bls-eth-wasm API doesn't provide this option. But imho, semantically if not in G2 implies not a signature (for eth) and hence shouldn't be loadable into the signature structure. Do you think there is a use of loading an invalid Signature point? my guess is not doing validation would be for the purposes of speed where one is sure of the correctness of signature. |
no but at this point i would remove the boolean from the signature of the method otherwise is a bug |
I can make it to default true, those who would want to skip validation could be explicit to pass false but will make it throw error in herumi and hence only work in blst @dapplion also, let know what you would think interface/behavior should be? (updated herumi wasm always does validation) |
nice this will also solve stuff like #2555 |
@asanso PR for the above resolution in the chainsafe/bls package. Have also added a test point for invalid signature for not in G2. Will create send another one for lodestar post merge of above for package update and making the validation flag to explicit true for readability purposes. 👍 |
The Lodestar's BLS signature validation when used in combination with bls/herumi is not sufficient.
The code assumes
This assumption is
true
for bls/blst where thevalidate
parameter is used. But not in the bls/herumi caseThe text was updated successfully, but these errors were encountered: