NextGen - critical-or-high's results

Advanced smart contracts for launching generative art projects on Ethereum.

General Information

Platform: Code4rena

Start Date: 30/10/2023

Pot Size: $49,250 USDC

Total HM: 14

Participants: 243

Period: 14 days

Judge: 0xsomeone

Id: 302

League: ETH

NextGen

Findings Distribution

Researcher Performance

Rank: 191/243

Findings: 1

Award: $0.08

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/MinterContract.sol#L196 https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/NextGenCore.sol#L189 https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/NextGenCore.sol#L193-L195

Vulnerability details

Impact

Functions MinterContract.mint() and NextGenCore.mint() lack re-entrancy protection. Moreover, NextGenCore.mint() violates the CEI pattern. As a result it's possible to mint more NFTs than permitted by the _maxAllowance parameter for MinterContract.mint().

A user who is eligible for the NFT mint during phase 1 can call MinterContract.mint() and present Merkle proof along with other parameters, including _maxAllowance. The leaf should be in the Merkle tree and incorporate msg.sender, _maxAllowance, and _tokenData.

Furthermore, the user shouldn't mint more than _maxAllowance and gencore.retrieveTokensMintedALPerAddress(col, msg.sendert) holds the number of NFTs minted so far.

Eventually, gencore.mint() is called.

Yet in gencore.mint() the value of tokensMintedAllowlistAddress is updated only after mintProcessing() which internally invokes _safeMint() with a callback. Therefore, a malicious minter could exploit callback from _safeMint() to call MinterContract.mint() recursively with the same Merkle proof to mint any number of NFTs, bypassing _maxAllowance upper bound.

Proof of Concept

Tools Used

Manual review.

Implement re-entrancy protection for MinterContract.mint() and NextGenCore.mint().

Assessed type

Reentrancy

#0 - c4-pre-sort

2023-11-20T02:21:21Z

141345 marked the issue as duplicate of #51

#1 - c4-pre-sort

2023-11-26T13:59:45Z

141345 marked the issue as duplicate of #1742

#2 - c4-judge

2023-12-08T16:39:27Z

alex-ppg marked the issue as satisfactory

#3 - c4-judge

2023-12-08T16:40:32Z

alex-ppg marked the issue as partial-50

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter