Skip to content
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

Dangerous lack of subgroup check for G2 groups in bls #126

Open
Rumata888 opened this issue May 26, 2022 · 3 comments
Open

Dangerous lack of subgroup check for G2 groups in bls #126

Rumata888 opened this issue May 26, 2022 · 3 comments

Comments

@Rumata888
Copy link

What is wrong?

G2 point decompression function goes through all the regular checks same as for G1 (checks that coordinates are in field and that the point is on curve). However, there is no subgroup check, which presents a security vulnerability, especially if someone tries to use this code for distributed key generation (then you can mount the baby sharks (https://medium.com/zengo/baby-sharks-a3b9ceb4efe0) attack).

How can it be fixed

Add subgroup checks when decompressing G2 points

@carver
Copy link
Collaborator

carver commented May 26, 2022

This is not my specialty. @ChihChengLiang could you take a look?

@Rumata888
Copy link
Author

For some reason the link I added to the post to the function got lost.

def decompress_G2(p: G2Compressed) -> G2Uncompressed:

@ChihChengLiang
Copy link
Contributor

Hi @Rumata888 and @carver,

We moved the subgroup check outside of the decompress_G2 after the refactor of #116 (cc @hwwhww).

  1. For public key (G1), we perform the subgroup check in KeyValidate. We check all core APIs with KeyValidate except for _AggregatePKs.
    if not subgroup_check(pubkey_point):
  2. For Signature (G2), the subgroup check is added to all APIs except for Aggregate.
    if not subgroup_check(signature_point):

Not sure if AggregateVerify is dangerous if we do the subgroup check for the aggregated instance instead of each instance. The latter is strictly safer. Asking @kevaundray for a second opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants