ENS Contest - auditor0517's results

Decentralised naming for web3

General Information

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

ENS

Findings Distribution

Researcher Performance

Rank: 4/59

Findings: 2

Award: $4,753.89

QA:
grade-a

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: Holmgren

Also found by: auditor0517

Labels

2 (Med Risk)
satisfactory
duplicate-180

Awards

4116.8235 USDC - $4,116.82

External Links

Judge has assessed an item in Issue #279 as 2 risk. The relevant finding follows:

[L-06] EllipticCurve.validateSignature has wrong and needless code blocks

        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

Awards

637.0684 USDC - $637.07

Labels

bug
grade-a
high quality report
QA (Quality Assurance)
sponsor acknowledged
Q-13

External Links

[L-01] Lack of length validation in 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.

[L-02] Wrong comment about base32HexTable

The comment says base32HexTable maps characters from 0x30 to 0x7A, but it actually maps from 0x30 to 0x76.

[L-03] Wrong validation of character

        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.

[L-04] Wrong validation of decoded value

        require(decoded <= 0x20);

This validation is not correct. The correct validation is decoded < 0x20.

[L-05] u might be 0 after validation

            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.

[L-06] EllipticCurve.validateSignature has wrong and needless code blocks

        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

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter