benadida/helios-server — pull request #46 by np (2013-08-21 09:54:32+00:00)
Title: Additionally check for the length of the array of proofs

This commit addresses a vulnerability in the verification of Zero-Knowledge proofs of Helios.

This issue can be explain using the specification at http://documentation.heliosvoting.org/verification-specs/helios-v3-verification-specs

In the specification the function `verify_disjunctive_0..max_proof` assumes that the `disjunctive_proof` argument is an array of size `max+1`. The code was missing this condition and thus accepting a valid proof of `n ∈ 0..max+k` as a **valid** proof of `n ∈ 0..max`.

The code (which appears twice, one of them seems to be dead code) receives no `max` argument but instead should check that `plaintexts` and `proof.proofs` arrays are of the same length.