Nibbl contest - shenwilly's results

NFT fractionalization protocol with guaranteed liquidity and price based buyout.

General Information

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

Nibbl

Findings Distribution

Researcher Performance

Rank: 68/96

Findings: 1

Award: $28.70

🌟 Selected for report: 0

🚀 Solo Findings: 0

Low Risk Vulnerabilities

1. getBasketAddress could return inaccurate value if basketImplementation changes

It is possible that the basketImplementation gets upgraded to a new address. If an integrator relies on getBasketAddress to deterministically determine the address of a basket that has been deployed using the old implementation, it will return the incorrect address.

Consider adding an extra parameter _implementation or overload the function with the extra parameter:

function getBasketAddress(address _curator, string memory _mix, address _basketImplementation) public override view returns(address _basket) { bytes32 newsalt = keccak256(abi.encodePacked(_curator, _mix)); bytes memory code = abi.encodePacked(type(ProxyBasket).creationCode, uint256(uint160(_basketImplementation))); bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), newsalt, keccak256(code))); _basket = address(uint160(uint256(hash))); }

https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVaultFactory.sol#L88-L93

2. Missing sanity check on _minBuyoutTime

When creating a vault, a faulty deployment payload could set minBuyoutTime to a very high value, virtually disabling the buyout function.

Consider adding a sanity check to make sure it's set within a reasonable value:

require(_minBuyoutTime <= 52 weeks, "NibblVault: minBuyoutTime must not be longer than one year");

https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L202

3. Check _feeAdmin instead of _adminFeeAmt

When charging fee in _chargeFee and _chargeFeeSecondaryCurve, there's a check to ensure _adminFeeAmt is larger than zero before transferring the funds to feeAdmin. It is possible for _adminFeeAmt to be higher than zero yet _feeAdmin returns zero because of rounding. Therefore, it will be more accurate to use _feeAdmin instead.

PoC

uint256 _feeAdmin = (_amount * _adminFeeAmt) / SCALE ;

When _amount * _adminFeeAmt is lower than SCALE, _feeAdmin will have the value of 0.

Check that _feeAdmin is larger than 0 instead:

if(_feeAdmin > 0) { safeTransferETH(_factory, _feeAdmin); //Transfers admin fee to the factory contract }

https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L227 https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L243

Non-Critical Vulnerabilities

1. Uncustomizable Basket details

When creating a basket, the basket name and symbol is fixed to "NFT Basket" and "NFTB" respectively. It would be hard for users to distinguish one basket from another when seen through etherscan or wallets.

Consider adding an extra parameter so basket creator can append a unique identifier for the baskets. For instance, when making a basket containing CryptoPunks, the name and symbol would be:

NFT Basket - Punks NFTB-PUNKS

https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVaultFactory.sol#L82 https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/Basket.sol#L13

#0 - mundhrakeshav

2022-06-26T06:56:55Z

if(_feeAdmin > 0) { safeTransferETH(_factory, _feeAdmin); //Transfers admin fee to the factory contract }

#1 - HardlyDifficult

2022-07-04T19:06:27Z

Good suggestions, targeting the specific project well

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