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

Weak FS + insecure primality check vulnerability #25

Open
agostbiro opened this issue Mar 29, 2024 · 0 comments
Open

Weak FS + insecure primality check vulnerability #25

agostbiro opened this issue Mar 29, 2024 · 0 comments

Comments

@agostbiro
Copy link

agostbiro commented Mar 29, 2024

Hi,

Thanks for what I think is the first Wesolowski VDF implementation in Rust!

As I studied up on Wesolowski VDF implementations, I noticed that this repo is vulnerable to the vulnerability described in the Weak Fiat-Shamir Attacks on Modern Proof Systems paper (p. 14 and onwards). The issue is that hash_prime doesn't include the time delay and the group description in the hash. This can lead to the attacker forging proofs for very large time delays. As the paper explains, an actual attack is unlikely since the time delay variable is only 64-bits. The fix would be to include the number of iterations and the discriminant in the hash.

The second issue is with the primality check in hash_prime. GMP's primality checking up to and including 6.1.2 was vulnerable to adversary controlled input, since it didn't do a Baillie-PSW primality test in addition to Miller-Rabin tests. My understanding is that this repo will use whatever version of GMP is installed on the system, so I think we should assert that we're using a safe version of GMP. The Prime and Prejudice: Primality Testing Under Adversarial Conditions contains more info about the problem with Miller-Rabin tests.

I'm happy to provide a PR if you agree with the proposed fixes.

I didn't think these vulnerabilities warrant private disclosure since the linked paper lists this repo as vulnerable to the first one and the second one is about using a vulnerable dependency.

Best,
Agost

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

1 participant