Foundation Drop contest - cccz's results

Foundation is a web3 destination.

General Information

Platform: Code4rena

Start Date: 11/08/2022

Pot Size: $40,000 USDC

Total HM: 8

Participants: 108

Period: 4 days

Judge: hickuphh3

Total Solo HM: 2

Id: 152

League: ETH

Foundation

Findings Distribution

Researcher Performance

Rank: 24/108

Findings: 3

Award: $97.20

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

42.8343 USDC - $42.83

Labels

bug
duplicate
2 (Med Risk)

External Links

Lines of code

https://github.com/code-423n4/2022-08-foundation/blob/792e00df429b0df9ee5d909a0a5a6e72bd07cf79/contracts/mixins/nftDropMarket/NFTDropMarketFixedPriceSale.sol#L170-L183

Vulnerability details

Impact

In the mintFromFixedPriceSale function of the NFTDropMarketFixedPriceSale contract, the number of NFTs that can be minted per account is limited by requiring IERC721(nftContract).balanceOf(msg.sender) + count <= saleConfig.limitPerAccount, but the user can bypass this limit by transferring NFTs to other accounts to reduce balanceOf(msg.sender).

Proof of Concept

https://github.com/code-423n4/2022-08-foundation/blob/792e00df429b0df9ee5d909a0a5a6e72bd07cf79/contracts/mixins/nftDropMarket/NFTDropMarketFixedPriceSale.sol#L170-L183

Tools Used

None

Consider using a status variable to keep track of the number of nft per account mint, and use that variable instead of balanceOf(msg.sender) to limit the number of nft per account mint

#0 - HardlyDifficult

2022-08-17T20:58:47Z

[Low-01] front-runnable initialize

Impact

In NFTCollectionFactory contract, the initialize function was missing access controls, allowing any user to initialize the contract. By front-running the contract deployers to initialize the contract, the incorrect parameters may be supplied, leaving the contract needing to be redeployed.

Proof of Concept

https://github.com/code-423n4/2022-08-foundation/blob/792e00df429b0df9ee5d909a0a5a6e72bd07cf79/contracts/NFTCollectionFactory.sol#L192-L194

Tools Used

None

Adding the onlyAdmin modifier to initialize function.

[Low-02] NFTCollectionFactory: initialize function did not initialize versionNFTDropCollection

Impact

In the initialize function of the NFTCollectionFactory contract, only versionNFTCollection will be initialized, but versionNFTDropCollection will not be initialized, so that the creator cannot control the initial version of the NFTDropCollections implementation contract

Proof of Concept

https://github.com/code-423n4/2022-08-foundation/blob/792e00df429b0df9ee5d909a0a5a6e72bd07cf79/contracts/NFTCollectionFactory.sol#L192-L194

Tools Used

None

Consider allowing creators to initialize versionNFTDropCollection in the initialize function

[Low-03] _safeMint() should be used rather than _mint() wherever possible

Impact

_mint() is discouraged in favor of _safeMint() which ensures that the recipient is either an EOA or implements IERC721Receiver.

Proof of Concept

https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/token/ERC721/ERC721Upgradeable.sol#L275 https://github.com/code-423n4/2022-08-foundation/blob/792e00df429b0df9ee5d909a0a5a6e72bd07cf79/contracts/NFTCollection.sol#L271-L272 https://github.com/code-423n4/2022-08-foundation/blob/792e00df429b0df9ee5d909a0a5a6e72bd07cf79/contracts/NFTDropCollection.sol#L182-L183

Tools Used

None

Use _safeMint instead of _mint

#0 - HardlyDifficult

2022-08-18T19:52:57Z

[Low-01] front-runnable initialize

Invalid. See our comment here for context

[Low-02] NFTCollectionFactory: initialize function did not initialize versionNFTDropCollection

This was intentional. versionNFTCollection is picking up from where our last factory had left off, while the drop collection is new so starting with the default value of 0 is correct.

Use safeMint

Agree will fix - for context see our response here.

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