-
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
NextGenMinter::burnToMint()
and NextGenMinter::burnOrSwapExternalToMint()
Multiple NFTs can be minted by burning/swapping just one NFT (Cross functional re-entrancy)
#76
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-411
edited-by-warden
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Comments
c4-submissions
added
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
labels
Nov 1, 2023
code4rena-admin
changed the title
Nov 1, 2023
NextGenMinter::burnToMint()
Multiple NFTs can be minted by burning just one NFT (Cross functional re-entrancy)NextGenMinter::burnToMint()
and NextGenMinter::burnOrSwapExternalToMint()
Multiple NFTs can be minted by burning just one NFT (Cross functional re-entrancy)
code4rena-admin
changed the title
Nov 1, 2023
NextGenMinter::burnToMint()
and NextGenMinter::burnOrSwapExternalToMint()
Multiple NFTs can be minted by burning just one NFT (Cross functional re-entrancy)NextGenMinter::burnToMint()
and NextGenMinter::burnOrSwapExternalToMint()
Multiple NFTs can be minted by burning/swapping just one NFT (Cross functional re-entrancy)
c4-bot-5
removed
the
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
label
Nov 5, 2023
code4rena-admin
added
the
3 (High Risk)
Assets can be stolen/lost/compromised directly
label
Nov 5, 2023
141345 marked the issue as primary issue |
c4-pre-sort
added
the
primary issue
Highest quality submission among a set of duplicates
label
Nov 18, 2023
141345 marked the issue as sufficient quality report |
c4-pre-sort
added
the
sufficient quality report
This report is of sufficient quality
label
Nov 18, 2023
c4-pre-sort
added
duplicate-1597
and removed
primary issue
Highest quality submission among a set of duplicates
labels
Nov 21, 2023
141345 marked the issue as duplicate of #1597 |
141345 marked the issue as duplicate of #1742 |
alex-ppg marked the issue as not a duplicate |
alex-ppg marked the issue as duplicate of #90 |
alex-ppg marked the issue as unsatisfactory: |
c4-judge
added
the
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
label
Dec 5, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-411
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/ff8cfc5529ee4a567e1ce1533b4651d6626d1def/hardhat/smart-contracts/NextGenCore.sol#L218
Vulnerability details
Impact
The
NextGenMinter::burnToMint()
andNextGenMinter::burnOrSwapExternalToMint()
method calls theNextGenCore::burnToMint()
andNextGenCore::mint()
method, which has a_safeMint()
function. This function enables the attacker's contract to re-enter into theNextGenMinter::mint()
method by using theonERC721Received
method, potentially allowing them to mint multiple NFTs while burning/swapping only one NFT.Although the user will pay for minting the NFT, it breaks of concept of the 1:1 burn/swap and mint ratio.
An important thing to consider here is, it's more of a use-case and logic-related issue than just re-entrance.
Ideally, if
burnToMint
orburnOrSwapExternalToMint
is initialized then the same collection should not be minted fromNextGenMinter::mint()
. If both are open to minting, then the following scenarios will take placeIf the minter collection reaches total supply by minting through the public
NextGenMinter::mint()
method, then burnToMint will become useless.If all NFTs from the burn collections are burned and minted, and if the minter collection max supply is reached, then the
NextGenMinter::mint()
method will become useless.If users raced against both methods, there is no control over which NFTs can be burned/swapped to mint and which NFTs can be minted directly from
NextGenMinter::mint()
.This will result in an uncertain no.of NFTs minted from burn/swap methods and simple mint methods.
Please check the last section for Mitigation steps.
Proof of Concept
Output Logs
After burning 1 NFT, the attacker can mint n NFTs, here it's 4.
Tools Used
Hardhat
Recommended Mitigation Steps
The first recommended step is to Add the ReentrancyGuard modifier to
NextGenMinter::mint()
,NextGenMinter::burnToMint()
andNextGenMinter::burnOrSwapExternalToMint()
.(and other potentially risky methods).An option to disable minting a collection from
NextGenMinter::mint()
if burnToMint/burnOrSwapExternalToMint is initialized for that particular collection.Assessed type
Reentrancy
The text was updated successfully, but these errors were encountered: