Platform: Code4rena
Start Date: 21/06/2022
Pot Size: $30,000 USDC
Total HM: 12
Participants: 96
Period: 3 days
Judge: HardlyDifficult
Total Solo HM: 5
Id: 140
League: ETH
Rank: 69/96
Findings: 1
Award: $28.42
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x29A, 0x52, 0xNazgul, 0xNineDec, 0xc0ffEE, 0xf15ers, 0xkatana, BowTiedWardens, Chom, ElKu, Funen, GalloDaSballo, JC, JMukesh, JohnSmith, Lambda, Limbooo, MadWookie, MiloTruck, Nethermind, Noah3o6, Nyamcil, Picodes, PwnedNoMore, Randyyy, RoiEvenHaim, SmartSek, StErMi, Tadashi, TerrierLover, TomJ, Tomio, Treasure-Seeker, UnusualTurtle, Varun_Verma, Wayne, Waze, _Adam, apostle0x01, asutorufos, berndartmueller, c3phas, catchup, cccz, cloudjunky, codexploder, cryptphi, defsec, delfin454000, dipp, ellahi, exd0tpy, fatherOfBlocks, hansfriese, hyh, joestakey, kebabsec, kenta, masterchief, minhquanym, naps62, oyc_109, pashov, peritoflores, reassor, rfa, robee, sach1r0, saian, sashik_eth, shenwilly, simon135, slywaters, sorrynotsorry, sseefried, unforgiven, xiaoming90, ych18, zuhaibmohd, zzzitron
28.4152 USDC - $28.42
Floating Pragma used in AccessControlMechanism.sol
. Contracts should be deployed with the same compiler version and flags that they have been tested with thoroughly. Locking the pragma (i.e. by not using ^) helps to ensure that contracts do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively.
Reference
The scoped contracts have different solidity compiler ranges (0.8.10,^0.8.10) referenced. This leads to potential security flaws between deployed contracts depending on the compiler version chosen for any particular file. It also greatly increases the cost of maintenance as different compiler versions have different semantics and behavior. Current Solidity version available is 0.8.15
No address(0)
or Zero value check at the constructors of:
ProxyBasket.sol, ProxyVault.sol, AccessControlMechanism.sol, NibblVaultFactory.sol.
Calls to external contracts inside a loop are dangerous (especially if the loop index can be user-controlled) because it could lead to DoS if one of the calls reverts or execution runs out of gas. Avoid calls within loops, check that loop index cannot be user-controlled or is bounded.Reference
Instances in Basket.sol;
Instances in NibblVault.sol;
The contract uses ecrecover() function in NibblVault contract. EVM's ecrecover is susceptible to signature malleability which allows replay attacks, but using OpenZeppelin’s ECDSA library can be mitigation in NibbleVault.sol for permit()
function. Reference
In NibblVault.sol, to reach the deadline the logic should be;
139: require(buyoutEndTime >= block.timestamp || buyoutEndTime == 0,'NibblVault: Bought Out');
instead of;
139: require(buyoutEndTime > block.timestamp || buyoutEndTime == 0,'NibblVault: Bought Out');
Critical address / value changes are not done in two steps for the following methods: In NibblVault.sol
EIP1155 states that the onERC1155Received
and onERC1155BatchReceived
MUST NOT be called on an EOA (Externally Owned Account).
Reference The contract can implement isContract()
function to fulfill this.
The require statement is missing at ecrecover()function in NibblVault.sol's permit() function. It can be amended as below;
require(owner!=address(0),"err"); address signer = ecrecover(toTypedMessageHash(structHash), v, r, s); require(signer == owner, "NibblVault: invalid signature");
The scoped contracts Basket.sol, NibblVault.sol are missing proper NatSpec comments such as @notice @dev @param on many places.It is recommended that Solidity contracts are fully annotated using NatSpec for all public interfaces (everything in the ABI) Reference
#0 - HardlyDifficult
2022-07-03T01:45:12Z
#1 - HardlyDifficult
2022-07-03T22:58:26Z
#2 - HardlyDifficult
2022-07-04T00:57:36Z
#3 - HardlyDifficult
2022-07-04T19:12:23Z
Some good considerations, esp in the merged reports.