Closed captainmangoC4 closed 11 months ago
Issue created on behalf of judge in order to split into 2 findings
I incorrectly labelled this submission to be split and as such will proceed to nullify it.
alex-ppg marked the issue as nullified
alex-ppg marked the issue as not nullified
alex-ppg marked the issue as nullified
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/NextGenCore.sol#L231
Vulnerability details
Reentrancy is a well know bug in smart contract and the protocol is not handling it, The safeMint function in ERC721 make a callback to the receiver checking if they can hold a nft, this can be used to a receiver to take control of the execution of the call. in this cases a malicius receiver can use this reentrancy problem to abuse the protocol in the following ways:
[Link]
[Link] [Link]
In this case Malicious receiver can abuse of the reentrancy problem to mint more than 1 nft for period without increment the price of Nft if the saleOption == 3 (see proof of concep).
Another problem if a Malicious receiver can mint several nft with just one nft passes if it is burn to mint collection:
[Link]
Minting before burning can allow a malicius receiver to reenter in the contract and burn just one passes and mint several nft.
Impact
Users can mint more than 1 token per period if burnToMint collection or burnOrSwapExternalToMint collection is in salesOption == 3 at the same Price. User can burn one nft mint passes and mint several nft. Other reentrancy problems.
Proof of Concept
(https://gist.github.com/jorgect207/5731a1bdf59786930178ee580eed3448) The three files in the gist have to be copied in the test file of the nextgen repository and have to install foundry in the hardhat repository Run the following test in the TestFoundry.sol:
see the Logs:
User can mint 16 nft in the same period without pay what he should pay.
Tools Used
foundry, manual
Recommended Mitigation Steps
Implement reentracy guard from oppenzepeling in the importan functions of the protocol to prevent reentrancy problems
Assessed type
Other