Possible to mint two auction tokens in a row #605
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-688
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/MinterContract.sol#L276-L298
Vulnerability details
Impact
Calling
mintAndAuction
ormint
gives opportunity to mint one token pertimePeriod
. But current implementation gives possibility to mint two token in single period or even worse in a single transaction.This behavior incorrect, and doesn't work as intended.
Proof of Concept
Let's consider next case:
lastMintDate[col] = 0
;allowlistStartTime + timePeriod * 2
;mint
, which mints 1 NFT, and tolastMintDate
:will be written
allowlistStartTime
;tDiff
:uint tDiff = (block.timestamp - timeOfLastMint) / collectionPhases[col].timePeriod;
will be 2, and this gives opportunity to mint another one token.Let's consider next test:
Here we got possibility to mint thee NFT in a row.
Tools Used
Manual review, Foundry
Recommended Mitigation Steps
lastMintDate
should beblock.timestamp
instead of last period calculation.Assessed type
Timing
The text was updated successfully, but these errors were encountered: