Burn to mint collection token can be sold or staked before the token is actually burned #527
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-1597
partial-50
Incomplete articulation of vulnerability; eligible for partial credit only (50%)
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/NextGenCore.sol#L218-L220
Vulnerability details
Impact
In Burn-to-Mint model, the token to be burned can be sold or staked before it's actually burned, the token owner will get unethical earnings, buyer or staking protocol will suffer a loss.
Proof of Concept
In Burn-to-Mint model, a user burns a NextGen token to get a new NextGen token on a different collection. When user calls burnToMint(...) function, user is not required to transfer the token to the protocol:
After some checks, function burnToMint(...) in
NextGenCore.sol
is called to do the actual minting and burning:It could be seen that new collection token will first be minted to user and then the old token is burned,
and in the _mintProcessing function,
_safeMint
is called:So if the new token receiver is a contract, a callback function
_checkOnERC721Received
in the receiver contract will be called:This is problematic because a malicious user can sell to stake the old token in the
_checkOnERC721Received
function, as the malicious user is still the owner of the token, after trading/staking, the token is burned, buyer or the staking protocol will lose the token forever.To verify, please deploy the below contract:
And run the test case in nextGen.test.js:
Tools Used
Manual Review
Recommended Mitigation Steps
Old collection token should be burned before minting new collection token.
Assessed type
ERC721
The text was updated successfully, but these errors were encountered: