code-423n4 / 2022-08-foundation-findings

0 stars 0 forks source link

`saleConfig.limitPerAccount` can be overriden #230

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Lines of code

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

Vulnerability details

[PNM-001] saleConfig.limitPerAccount can be overriden

Links

Description

The contract NFTDropMarketFix implements a limit on the amount of NFTs that an account can mint with the function mintFromFixedPriceScale. This is done via a comparison of the balanceOf() of an account and the saleConfig.limitPerAccount. However, this check can be bypassed by account holders transferring the NFTs to other accounts offchain, causing the balanceOf() the account to decrease, thus allowing the account to potentially buy more than the saleConfig.limitPerAccount.

PoC / Attack Scenario

Consider creating an availableMint value for every account, and when mintFromFixedriceScale is called, decrease the amount minted from the availableMint.

ghost commented 2 years ago

My issue here https://github.com/code-423n4/2022-08-foundation-findings/issues/59 with a proof of concept test in foundry but I disagree with severity as there are no loss of funds.

There are also too many dups for this issue so I won't list all of them down. Please check the de-dupe tool shared by kartoonjoy.

HardlyDifficult commented 2 years ago

Dupe of https://github.com/code-423n4/2022-08-foundation-findings/issues/59