Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: medium
Invalid

REENTRANCY_IN_SELECT_WINNER

Summary

Reentrancy gives attacker execution flow when info for token id is updated but token is not minted, allowing him to re-mint nft with same id

Vulnerability Details

Call to the winner (bool success,) = winner.call{value: prizePool}(""); appears before the token minting _safeMint(winner, tokenId); in selectWinner. So winner in fallback function can run round again, mint NFT with the same id as uint256 tokenId = totalSupply(); is not changed, but with higher rarity that will overwrite tokenIdToRarity[tokenId]. Then burn the token and return from fallback where nft with the same id will be minted

Impact

Ability to increase rarity of nft with current id

Tools Used

Recommendations

Add nonReentrant modifier, make call to the winner only after side effects

Updates

Lead Judging Commences

Hamiltonite Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.