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

fix: incorrect alias check brought from snarkjs. (possible security vulnerability) #737

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

Stumble
Copy link
Contributor

@Stumble Stumble commented Apr 5, 2024

Description

There seems to be a security bug brought by using the new template from snarkjs: the public signal alias checks were incorrectly done against BASE_MODULUS instead of SCALAR_MODULUS.

Previous releases do not have this issue because alias checks were correctly done in Pairing.sol

See iden3/snarkjs#480 for more details.

Related Issue(s)

Other information

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have run yarn prettier and yarn lint without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link

fix: incorrect alias check brought from snarkjs. (possible security vulnerability)

Generated at commit: 8e246c48bf34c7d72a5aba8a279002da9a6db501

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
0
0
4
16
20
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@Stumble
Copy link
Contributor Author

Stumble commented Apr 5, 2024

Although the nullifier is an enough-random hash value, and (q-r)/r is small (~6.7e-39) is relatively small, when the stake is high, i think it is still possible to be exploited.

@cedoor cedoor requested a review from 0xbok April 8, 2024 11:12
@cedoor cedoor added this to the Semaphore V4 milestone Apr 8, 2024
@cedoor cedoor added the bug 🐛 Something isn't working label Apr 8, 2024
Copy link
Member

@cedoor cedoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Stumble, thank you so much!

@cedoor cedoor merged commit a4a6837 into semaphore-protocol:main Apr 12, 2024
5 of 6 checks passed
Copy link

gitpoap-bot bot commented Apr 12, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2024 Semaphore Contributor:

GitPOAP: 2024 Semaphore Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
Status: ✔️ Done
Development

Successfully merging this pull request may close these issues.

2 participants