Open code423n4 opened 3 years ago
I am slightly mixed about this finding. We did employ fuzz tests during the audit we had gone through and they were unable to pinpoint any issues in the value range we expect the curve to be utilized in. This is definitely a good suggestion and one we will assimilate, however, I am not sure how one would judge the severity of this.
Handle
a_delamo
Vulnerability details
Impact
FairSideFormula library is using ABDKMathQuad library underneath. According to the ABDKMathQuad README, the range of values is the following:
Using Echidna, a fuzzing tool for smart contracts, I found some edge cases when some of the operations do not work as expected. This is the test code I run using
echidna-test contracts/TestABDKMathQuad --contract TestABDKMathQuad
And the results are:
If we check in Remix, we can see there is a small difference when converting from UInt to Bytes16 or the opposite way. This is probably the same issue with all the other operations.
Tools Used
Echidna https://github.com/crytic/echidna
Recommended Mitigation Steps
Use some fuzzing tool like Echidna to verify there is no edge cases