recipient of mintAndAuction(...) token can use burnToMint(...) function to mint in another or same collection before auction ended #1744
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-364
edited-by-warden
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L258-L272
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L297
Vulnerability details
Impact
AuctionDemo.sol
contract without a means to retrieve them.Proof of Concept
(See coded POC for Loss of funds below)
To start an auction, the
functionAdmin
calls themintAndAuction(...)
function in theMinterContract.sol
with the address of the minted token's_recipient
. To make this minted token eligible for Auction, themintAndAuction(...)
function updatesmintToAuctionStatus[mintIndex] = true
.However, a malicious recipient can call the
burnToMint(...)
to burn the token in active auction and mint a token in a different collection as shown in the coded POC.This is possible because
the
burnToMint(...)
function does not checkmintToAuctionStatus[mintIndex]
status of the token it is attempting to burn.the
initializeBurn(...)
function does not check if themintToAuctionStatus[mintIndex]
of the token token before the admin initializes the burning for the token.ATTACK VECTOR for Loss of funds
mintAndAuction(...)
token withtokenId
= 20000000002.mintCollectionId
= 3,collectionId
= 2burnToMint(...)
with thetokenId
= 20000000002,_burnCollectionID
= 2 and_mintCollectionID
= 3tokenId
= 20000000002,claimAuction(...)
function but it reverts because Alice has renounced ownership of thetokenId
= 20000000002 by burning to mint a new token in new collectionCODED POC for Loss of funds
Below is a POC to demonstrate that Alice can burn a token with active auction and token ownership will be transferred to the burn address
_ call
mintAndAuction(...)
with recipient (Alice)burnToMint(...)
with the minted tokenAdd the test case the existing
nextGen.test.js
file and runnpx hardhat test
Tools Used
Manual Review
Hardhat
Recommended Mitigation Steps
Add a require statement in the
burnToMint(...)
function in theMinterContract.sol
contract to check that themintToAuctionStatus[mintIndex]
isfalse
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: