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: 31/59
Findings: 1
Award: $59.79
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 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
59.7928 USDC - $59.79
Context:
Recommendation:
Add non-zero address checks when set address state variables.
Context:
Description:
While Solidity 0.8.x checks for overflows on arithmetic operations, it does not do so for casting.
Recommendation:
Use OpenZeppelin’s SafeCast library to prevent unexpected overflows.
Context:
import "./Owned.sol";
L5Description:
Lack of two-step procedure for transfer of ownership makes it error-prone. It’s possible that the owner mistakenly transfers ownership to the uncontrolled account and it will break all functions with owner_only() modifier.
Recommendation:
Implement a two step process for transfer of ownership. Owner call transferOwnership() function where nominates an account. Nominated account needs to call an acceptOwnership() function for the transfer of ownership to fully succeed. This will confirm that the nominated EOA account is valid and active account.
Context:
emit NewPublicSuffixList(address(suffixes));
L82emit AlgorithmUpdated(id, address(algo));
L66emit DigestUpdated(id, address(digest));
L77Description:
Events are generally emitted when sensitive changes are made to the contracts. Some events are missing important parameters.
Context:
event Debug(bytes32 x);
L4
Context:
return ("", "", type(uint256).max);
L25return _enableNode(domain, 0);
L171return node;
L204return uint8(self[idx]);
L183return self.substring(offset, len);
L46return true;
L129return false;
L131return toAffinePoint(x1, y1, z1);
L371return verifyRRSet(input, block.timestamp);
L96return (proof, inception);
L127return rrset;
L173return (dnsName, node);
L50Recommendation:
Choose named return variable or return statement.
Context:
uint256 otheroffset,
L57 (Change to otherOffset)uint256 otherlen
L58 (Change to otherLen)bytes constant base32HexTable =
L322 (Constant name must be in capitalized SNAKE_CASE)uint256 constant a =
L21 (Constant name must be in capitalized SNAKE_CASE)uint256 constant b =
L23 (Constant name must be in capitalized SNAKE_CASE)uint256 constant gx =
L25 (Constant name must be in capitalized SNAKE_CASE)uint256 constant gy =
L27 (Constant name must be in capitalized SNAKE_CASE)uint256 constant p =
L29 (Constant name must be in capitalized SNAKE_CASE)uint256 constant n =
L31 (Constant name must be in capitalized SNAKE_CASE)uint256 constant lowSmax =
L34 (Constant name must be in capitalized SNAKE_CASE)uint256 LHS = mulmod(y, y, p); // y^2
L142 (Variable name must be in mixedCase)uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3
L143 (Variable name must be in mixedCase)uint256[2] memory Q
L389 (function param name must be in mixedCase)uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);
L408 (Variable name must be in mixedCase)uint256 Px = inverseMod(P[2], p);
L414 (Variable name must be in mixedCase)bytes memory N,
L15 (Function param name must be in mixedCase)bytes memory E,
L16 (Function param name must be in mixedCase)bytes memory S
L17 (Function param name must be in mixedCase)Description:
The above codes don't follow Solidity's standard naming convention.
Context:
uint16 constant CLASS_INET = 1;
L16uint16 constant TYPE_TXT = 16;
L17function parseRR(
L136function readTXT(
L162function parseAndResolve(
L173function resolveName(
L190function textNamehash(
L209function memcpy(uint256 dest, uint256 src, uint256 len) private pure {
L273function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {
L40function toProjectivePoint(
L65function addAndReturnProjectivePoint(
L77function toAffinePoint(
L92function zeroProj()
L106function zeroAffine() internal pure returns (uint256 x, uint256 y) {
L117function isZeroCurve(
L124function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {
L137function twiceProj(
L159function addProj(
L208function addProj2(
L247function add(
L286function twice(
L302function multiplyPowerBase2(
L316function multiplyScalar(
L335function multipleGeneratorByScalar(
L377function validateSignature(
L386function parseSignature(
L30function parseKey(
L37function validateSignedSet(
L140function validateRRs(
L181function verifySignature(
L225function verifyWithKnownKey(
L254function verifySignatureWithKey(
L285function verifyWithDS(
L330function verifyKeyWithDS(
L373function verifyDSHash(
L415Description:
Internal and private functions, state variables, constants, and immutables should starting with an underscore.
Context:
uint16 constant CLASS_INET = 1;
L16uint16 constant TYPE_TXT = 16;
L17bytes constant base32HexTable =
L322uint256 constant RRSIG_TYPE = 0;
L72uint256 constant RRSIG_ALGORITHM = 2;
L73uint256 constant RRSIG_LABELS = 3;
L74uint256 constant RRSIG_TTL = 4;
L75uint256 constant RRSIG_EXPIRATION = 8;
L76uint256 constant RRSIG_INCEPTION = 12;
L77uint256 constant RRSIG_KEY_TAG = 16;
L78uint256 constant RRSIG_SIGNER_NAME = 18;
L79uint256 constant DNSKEY_FLAGS = 0;
L210uint256 constant DNSKEY_PROTOCOL = 2;
L211uint256 constant DNSKEY_ALGORITHM = 3;
L212uint256 constant DNSKEY_PUBKEY = 4;
L213uint256 constant DS_KEY_TAG = 0;
L236uint256 constant DS_ALGORITHM = 2;
L237uint256 constant DS_DIGEST_TYPE = 3;
L238uint256 constant DS_DIGEST = 4;
L239uint256 constant a =
L21uint256 constant b =
L23uint256 constant gx =
L25uint256 constant gy =
L27uint256 constant p =
L29uint256 constant n =
L31uint256 constant lowSmax =
L34uint16 constant DNSCLASS_IN = 1;
L27uint16 constant DNSTYPE_DS = 43;
L29uint16 constant DNSTYPE_DNSKEY = 48;
L30uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;
L32Context:
bytes constant base32HexTable =
L322 (constant can not go after internal function)uint256 constant RRSIG_TYPE = 0;
L72 (state variable can not go after internal function)Description:
According to official solidity documentation inside each contract, library or interface, use the following order:
Context:
function memcpy(uint256 dest, uint256 src, uint256 len) private pure {
L273function readSignedSet(
L94function parseSignature(
L30function parseKey(
L37Context:
* @dev Compares a range of 'self' to all of 'other' and returns True iff
L141 (Change iff to if)* @return True iff the signature is valid.
L15 (Change iff to if)Context:
* @dev Compares two serial numbers using RFC1982 serial number math.
L330 (param and return tags are missing)* @dev Computes (base ^ exponent) % modulus over big numbers.
L5 (param and return tags are missing)RRUtils.SignedSet memory rrset,
L227 (param rrset is missing)bytes memory keyrdata,
L287 (param keyrdata is missing)#0 - c4-judge
2023-05-09T10:35:15Z
dmvt marked the issue as grade-b