Platform: Code4rena
Start Date: 14/04/2023
Pot Size: $90,500 USDC
Total HM: 7
Participants: 59
Period: 14 days
Judge: LSDan
Total Solo HM: 3
Id: 232
League: ETH
Rank: 4/59
Findings: 2
Award: $4,753.89
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Holmgren
Also found by: auditor0517
4116.8235 USDC - $4,116.82
Judge has assessed an item in Issue #279 as 2 risk. The relevant finding follows:
if (P[2] == 0) { return false; } uint256 Px = inverseMod(P[2], p); Px = mulmod(P[0], mulmod(Px, Px, p), p);
Px = p[0] * (inverse(P[2]))^2 is not correct here. Fortunately, P[2] is always 1 after addAndReturnProjectivePoint
, so there is no problem. We can safely remove the wrongly implemented blocks.
#0 - c4-judge
2023-05-10T09:23:24Z
dmvt marked the issue as duplicate of #180
#1 - c4-judge
2023-05-10T09:23:28Z
dmvt marked the issue as satisfactory
🌟 Selected for report: Sathish9098
Also found by: 0x73696d616f, 0xAgro, 0xSmartContract, 0xTheC0der, ABA, ArbitraryExecution, Aymen0909, BRONZEDISC, Bauchibred, Dyear, Eurovickk, IceBear, Jerry0x, Jorgect, Josiah, MalfurionWhitehat, MohammedRizwan, RaymondFam, Recep, Rickard, SAAJ, Shubham, Udsen, auditor0517, brgltd, catellatech, chaduke, codeslide, eierina, favelanky, j4ld1na, lukris02, matrix_0wl, naman1778, pontifex, schrodinger, tnevler, urataps
637.0684 USDC - $637.07
BytesUtils.equals
return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);
BytesUtils.equals
only checks the hash values of two strings. We can add length validation for more safety, and other equal
method (on line 164) checked the lengths.
base32HexTable
The comment says base32HexTable
maps characters from 0x30 to 0x7A, but it actually maps from 0x30 to 0x76.
require(char >= 0x30 && char <= 0x7A);
base32HexTable
only maps characters from 0x30 to 0x76, so 0x7A is not correct here. 0x76 is the correct for current base32HexTable
. We can also extend base32HexTable
in case of using 0x7A.
require(decoded <= 0x20);
This validation is not correct. The correct validation is decoded
< 0x20
.
if (u == 0 || u == m || m == 0) return 0; if (u > m) u = u % m;
EllipticCurve.inverseMod
gets a residue after validation. In EllipticCurve
, m is p or n, and p*2, n*2 > 2^256.
So this is safe. But in general context, this is not safe. So it is better to swap these two lines.
if (P[2] == 0) { return false; } uint256 Px = inverseMod(P[2], p); Px = mulmod(P[0], mulmod(Px, Px, p), p);
Px = p[0] * (inverse(P[2]))^2 is not correct here. Fortunately, P[2] is always 1 after addAndReturnProjectivePoint
, so there is no problem. We can safely remove the wrongly implemented blocks.
#0 - c4-pre-sort
2023-05-02T05:50:41Z
thereksfour marked the issue as high quality report
#1 - c4-sponsor
2023-05-05T12:47:39Z
Arachnid marked the issue as sponsor acknowledged
#2 - c4-judge
2023-05-09T10:10:02Z
dmvt marked the issue as grade-b
#3 - c4-judge
2023-05-12T13:33:55Z
dmvt marked the issue as grade-a