Foundation Drop contest - yixxas'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: 68/108

Findings: 1

Award: $42.83

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

42.8343 USDC - $42.83

Labels

bug
duplicate
2 (Med Risk)
edited-by-warden

External Links

Lines of code

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

Vulnerability details

Impact

Calling balanceOf(msg.sender) to check if an address has minted more than allowed is bad since buyer can always transfer away the NFT after minting, and hence mint more than allowed, making it unfair for other parties. This is important when we want to only allow certain addresses to mint, and we want to limit this address from minting more than allowed.

Proof of Concept

L183 checks for (IERC721(nftContract).balanceOf(msg.sender) + count > saleConfig.limitPerAccount), which can easily be bypassed by transferring NFT to another address before calling mintFromFixedPriceSale.

NFTDropMarketFixedPriceSale.sol#L183-L189

function mintFromFixedPriceSale( address nftContract, uint16 count, address payable buyReferrer ) external payable returns (uint256 firstTokenId) { ... if (IERC721(nftContract).balanceOf(msg.sender) + count > saleConfig.limitPerAccount) { if (saleConfig.limitPerAccount == 0) { // Provide a more targeted error if the collection has not been listed. revert NFTDropMarketFixedPriceSale_Must_Have_Sale_In_Progress(); } revert NFTDropMarketFixedPriceSale_Cannot_Buy_More_Than_Limit(saleConfig.limitPerAccount); } ... }

Tools Used

Consider using mapping(address => uint) to track number of NFTs an account has minted instead of using balanceOf.

#0 - HardlyDifficult

2022-08-17T20:58:55Z

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