Platform: Code4rena
Start Date: 12/07/2022
Pot Size: $75,000 USDC
Total HM: 16
Participants: 100
Period: 7 days
Judge: LSDan
Total Solo HM: 7
Id: 145
League: ETH
Rank: 40/100
Findings: 3
Award: $125.39
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: rajatbeladiya
Also found by: 0x29A, 0xNineDec, Amithuddar, Aussie_Battlers, Ch_301, Dravee, GimelSec, IllIllI, Jujic, Limbooo, RedOneN, Ruhum, TomJ, _Adam, __141345__, alan724, asutorufos, berndartmueller, c3phas, cccz, cryptphi, durianSausage, fatherOfBlocks, hake, hyh, pashov, scaraven, zzzitron
5.45 USDC - $5.45
The use of the deprecated transfer()
function for an address will inevitably make the transaction fail when:
File: main/contracts/ethregistrar/ETHRegistrarController.sol 183: payable(msg.sender).transfer 204: payable(msg.sender).transfer(msg.value - price.base); 211: payable(owner()).transfer(address(this).balance);
I recommend using call()
instead of transfer()
.
#0 - jefflau
2022-07-22T09:50:31Z
Duplicate of #133
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x29A, 0xDjango, 0xNazgul, 0xNineDec, 0xf15ers, 8olidity, Aussie_Battlers, Bnke0x0, Ch_301, Critical, Deivitto, Dravee, ElKu, Funen, GimelSec, JC, JohnSmith, Lambda, MiloTruck, PwnedNoMore, ReyAdmirado, Rohan16, Rolezn, Ruhum, RustyRabbit, Sm4rty, TomJ, Waze, _Adam, __141345__, alan724, asutorufos, benbaessler, berndartmueller, bin2chen, brgltd, bulej93, c3phas, cRat1st0s, cryptonue, cryptphi, csanuragjain, delfin454000, dxdv, exd0tpy, fatherOfBlocks, gogo, hake, hyh, joestakey, kyteg, lcfr_eth, minhtrng, p_crypt0, pashov, pedr02b2, philogy, rajatbeladiya, rbserver, rishabh, robee, rokinot, sach1r0, sashik_eth, seyni, simon135, svskaushik, zuhaibmohd, zzzitron
79.4817 USDC - $79.48
Findings
File: main/contracts/ethregistrar/ETHRegistrarController.sol 210: function withdraw() public { 211: payable(owner()).transfer(address(this).balance); 212: }
Findings
File: main/contracts/ethregistrar/ETHRegistrarController.sol 88: address owner 127: address owner
Findings
File: /main/contracts/registry/ReverseRegistrar.sol 16: // namehash('addr.reverse')
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/registry/ReverseRegistrar.sol#L16
Description Complex pragmas are also possible using ‘>’,’>=‘,’<‘ and ‘<=‘ symbols to combine multiple versions e.g. “pragma solidity >=0.8.0 <0.8.3;”
Findings SHA1.sol ETHRegistrarController.sol IETHRegistrarController.sol StringUtils.sol ReverseRegistrar.sol IReverseRegistrar.sol BytesUtil.sol IMetadataService.sol ENS.sol Resolver.sol
Description A ‘^’ symbol prefixed to x.y.z in the pragma indicates that the source file may be compiled only from versions starting with x.y.z until x.(y+1).z. For e.g., “pragma solidity ^0.8.3;” indicates that source file may be compiled with compiler version starting from 0.8.3 until any 0.8.z but not 0.9.z. This is known as a “floating pragma.”.
Findings BytesUtils.sol DNSSECImpl.sol RRUtils.sol Owned.sol DNSSEC.sol Algorithm.sol Digest.sol ERC1155Fuse.sol NameWrapper.sol INameWrapper.sol Controllable.sol INameWrapperUpgrade.sol
Contracts are allowed to override their parents’ functions and change the visibility from external
to public
.
Findings
File: /main/contracts/dnssec-oracle/DNSSECImpl.sol 58: function setAlgorithm(uint8 id, Algorithm algo) public owner_only 69: function setDigest(uint8 id, Digest digest) public owner_only
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/dnssec-oracle/DNSSECImpl.sol#L58
File: /main/contracts/ethregistrar/ETHRegistrarController.sol 120: function commit(bytes32 commitment) public override 125: function register 210: function withdraw() public
File: /main/contracts/registry/ReverseRegistrar.sol 51: function setDefaultResolver(address resolver) public override onlyOwner 97: function claimWithResolver(address owner, address resolver)
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/registry/ReverseRegistrar.sol#L51
Findings
File: main/contracts/ethregistrar/ETHRegistrarController.sol 173: emit NameRegistered( 174: name, 175: keccak256(bytes(name)), 176: owner, 177: price.base, 178: price.premium, 179: expires 180: ); 181: 182: 183: if (msg.value > (price.base + price.premium)) { 184: payable(msg.sender).transfer( 185: msg.value - (price.base + price.premium) 186: ); 187: }
🌟 Selected for report: 0xKitsune
Also found by: 0x040, 0x1f8b, 0x29A, 0xNazgul, 0xNineDec, 0xsam, 8olidity, Aussie_Battlers, Aymen0909, Bnke0x0, CRYP70, Ch_301, Chom, Deivitto, Dravee, ElKu, Fitraldys, Funen, GimelSec, IllIllI, JC, JohnSmith, Lambda, MiloTruck, Noah3o6, RedOneN, ReyAdmirado, Rohan16, Rolezn, Ruhum, Sm4rty, TomJ, Tomio, Waze, _Adam, __141345__, ajtra, ak1, arcoun, asutorufos, benbaessler, brgltd, bulej93, c3phas, cRat1st0s, cryptonue, delfin454000, durianSausage, fatherOfBlocks, gogo, hake, hyh, joestakey, karanctf, kyteg, lcfr_eth, lucacez, m_Rassska, rajatbeladiya, rbserver, robee, rokinot, sach1r0, sahar, samruna, sashik_eth, seyni, simon135, zuhaibmohd
40.4596 USDC - $40.46
Description
If a reference type function parameter is read-only, it is cheaper in gas to use calldata instead of memory. Calldata is a non-modifiable, non-persistent area where function arguments are stored, and behaves mostly like memory.
It is better to use calldata as a data location because it will avoid copies and also makes sure that the data cannot be modified.
Findings
File: /main/contracts/dnssec-oracle/DNSSECImpl.sol 80: function verifyRRSet(RRSetWithSignature[] memory input) external virtual view override returns(bytes memory) 91: function verifyRRSet(RRSetWithSignature[] memory input, uint256 now) public virtual view override returns(bytes memory) { 110: function validateSignedSet(RRSetWithSignature memory input, bytes memory proof, uint256 now) internal view returns(RRUtils.SignedSet memory rrset)
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/dnssec-oracle/DNSSECImpl.sol#L80
File: main/contracts/ethregistrar/ETHRegistrarController.sol 67: function rentPrice(string memory name, uint256 duration) 77: function valid(string memory name) public pure returns (bool) 81: function available(string memory name) public view override returns (bool) 87: string memory name 227: string memory name 271: string memory name
Findings
File: /main/contracts/dnssec-oracle/BytesUtils.sol 56: for (uint idx = 0; idx < shortest; idx += 32) 256: for(uint i = 0; i < len; i++)
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/dnssec-oracle/BytesUtils.sol#L56
File: /main/contracts/dnssec-oracle/DNSSECImpl.sol 93: for(uint i = 0; i < input.length; i++)
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/dnssec-oracle/DNSSECImpl.sol#L93
File: /main/contracts/ethregistrar/ETHRegistrarController.sol 256: for (uint256 i = 0; i < data.length; i++)
Description
Prefix increments are cheaper than postfix increments, eg ++i rather than i++
Findings
File: /main/contracts/dnssec-oracle/BytesUtils.sol 256: for(uint i = 0; i < len; i++)
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/dnssec-oracle/BytesUtils.sol#L266
File: /main/contracts/dnssec-oracle/DNSSECImpl.sol 93: for(uint i = 0; i < input.length; i++)
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/dnssec-oracle/DNSSECImpl.sol#L93
File: /main/contracts/ethregistrar/ETHRegistrarController.sol 256: for (uint256 i = 0; i < data.length; i++)
description
The code can be optimized by minimizing the number of SLOAD
s. SLOAD
s are expensive (100 gas) compared to MLOAD
s/MSTORE
s (3 gas).
Findings
File: /main/contracts/dnssec-oracle/DNSSECImpl.sol 93: for(uint i = 0; i < input.length; i++)
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/dnssec-oracle/DNSSECImpl.sol#L93
File: /main/contracts/ethregistrar/ETHRegistrarController.sol 256: for (uint256 i = 0; i < data.length; i++)
description
Each extra chunk of byetes past the original 32 incurs an MSTORE
which costs 3 gas
Findings
File: /main/contracts/ethregistrar/ETHRegistrarController.sol 101: "ETHRegistrarController: resolver is required when data is supplied" 139: "ETHRegistrarController: Not enough ether provided" 198: "ETHController: Not enough Ether provided for renewal" 234: "ETHRegistrarController: Commitment is not valid" 240: "ETHRegistrarController: Commitment has expired" 242: require(available(name), "ETHRegistrarController: Name is unavailable"); 261: "ETHRegistrarController: Namehash on record do not match the name being registered"
File: /main/contracts/registry/ReverseRegistrar.sol 46: "ReverseRegistrar: Caller is not a controller or authorized by address or the address itself" 54: "ReverseRegistrar: Resolver address must not be 0"
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/registry/ReverseRegistrar.sol#L46
description Custom errors are available from solidity version 0.8.4. The instances below match or exceed that version
Findings
File: /main/contracts/ethregistrar/ETHRegistrarController.sol 101: "ETHRegistrarController: resolver is required when data is supplied" 139: "ETHRegistrarController: Not enough ether provided" 198: "ETHController: Not enough Ether provided for renewal" 234: "ETHRegistrarController: Commitment is not valid" 240: "ETHRegistrarController: Commitment has expired" 242: require(available(name), "ETHRegistrarController: Name is unavailable"); 261: "ETHRegistrarController: Namehash on record do not match the name being registered"
File: /main/contracts/registry/ReverseRegistrar.sol 46: "ReverseRegistrar: Caller is not a controller or authorised by address or the address itself" 54: "ReverseRegistrar: Resolver address must not be 0"
https://github.com/code-423n4/2022-07-ens/blob/main/contracts/registry/ReverseRegistrar.sol#L46