In EcPairing.yul, the final parameter to g2JacobianDouble is wrong in g2ScalarMul implementation when scalar is 0x02. It should pass zp1 instead of yp1.
EcPairing.yul is part of the precompiled special-purpose circuits, which consist the main component of ZKsyncVM and it is specifically designed for elliptic curve pairing operations.
It contains many functions to perform computationally intensive operations including g2IsInSubGroup, g2IsInSubGroupNaive which are used to check if a G2 point in jacobian coordinates is in the subgroup of the twisted curve.
Both functions use g2ScalarMul to multiply a G2 point represented in jacobian coordinates by a scalar, which internally uses g2JacobianDouble function to calculate a jacobian double. There's an issue with the final parameter to g2JacobianDouble when scalar is 0x02. Below is the definition of g2ScalarMul function:
It passed yp1 as the final parameter which should be zp1 in regards to the definition of g2JacobianDouble function:
This highlights the incorrect usage of a parameter within the g2ScalarMul function, leading to inaccurate Jacobian multiplication calculations, which would subsequently affect the outcomes of higher-level functions.
The incorrect parameter usage within the g2ScalarMul function in EcPairing.yul leads to inaccurate Jacobian multiplication calculations. This directly impacts the correctness of subgroup validation functions such as g2IsInSubGroup and g2IsInSubGroupNaive, which rely on g2ScalarMul to verify if a G2 point belongs to the subgroup of the twisted curve.
As a result, higher-level functions that depend on accurate elliptic curve pairing operations may produce invalid outcomes, potentially compromising the integrity and security of the ZKsyncVM’s cryptographic operations.
Manual Review
Update g2ScalarMul function to pass the correct parameter.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.