-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The mint() function is vulnerable to reentrancy, allowing malicious users to exceed the maximum allowed mint amount and inflate the collectionCirculationSupply
.
#648
Comments
141345 marked the issue as duplicate of #51 |
141345 marked the issue as duplicate of #1742 |
alex-ppg marked the issue as satisfactory |
alex-ppg marked the issue as partial-25 |
alex-ppg marked the issue as unsatisfactory: |
First, I referenced two places where states are not updated according to the CEI pattern in the Lines of code section and mentioned that the tokensMintedAllowlistAddress[_collectionID][_mintingAddress] = tokensMintedAllowlistAddress[_collectionID][_mintingAddress] + 1;
tokensMintedPerAddress[_collectionID][_mintingAddress] = tokensMintedPerAddress[_collectionID][_mintingAddress] + 1; Secondly, I provided a clear explanation of the bug's impact. Thirdly, I explained how it can be exploited to harm the protocol. I need more context to understand why this finding is considered completely unsatisfactory and worthless. |
Hey @RunSoul22, thanks for requesting follow-up clarifications! A finding marked as If your submission was the only present in the contest, it would have been awarded in full. However, in the interest of competitiveness, I am inclined to grade submissions on a "curve" rather than impose the bare minimum. Keep in mind that the bare minimum is acceptable for QA submissions, but not submissions in the HM pool. I will revisit this for a |
alex-ppg marked the issue as partial-25 |
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/NextGenCore.sol#L189
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/NextGenCore.sol#L195
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/NextGenCore.sol#L197
Vulnerability details
Impact
The
NextGenCore.mint()
function does not follow the check-effect-interaction pattern.A malious user can mint more than the maximum allowed mint amount and inflate the
collectionCirculationSupply
.Proof of Concept
ERC721._safeMint()
transfer control to the recipient when a token is minted.When
NextGenCore.mint()
is called, it mints an NFT and transfers control to the_mintingAddress
. It then updates either thetokensMintedAllowlistAddress
ortokensMintedPerAddress
mapping. If the_mintingAddress
is a contract, then it can reenter and callNextGenMinterContract.mint()
to mint more tokens than allowed.A malious user can also infalte the
collectionCirculationSupply
by reentrancy but he is not able to mint more NFTs thancollectionTotalSupply
.For example:
Given:
collectionCirculationSupply
= 990collectionTotalSupply
= 1000The attacker can inflate the
collectionCirculationSupply
to 1045 (990 + 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) by reentering theNextGenMinterContract.mint()
function.Tools Used
VS Code
Recommended Mitigation Steps
NextGenCore.mint()
function.collectionAdditionalData[_collectionID].collectionTotalSupply < collectionAdditionalData[_collectionID].collectionCirculationSupply
Assessed type
Reentrancy
The text was updated successfully, but these errors were encountered: