Closed c4-submissions closed 11 months ago
141345 marked the issue as sufficient quality report
a2rocket (sponsor) disputed
as reported on the bot racer report we will add checks to make sure transaction passed
The Warden's submission is incorrect as an event will not be emitted when a transaction reverts. Events are state-changing and thus are reverted when a transaction fails. The PoC provided utilizes a special expectRevert
system which will force the transaction to "not fail".
alex-ppg marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L282-L294
Vulnerability details
Impact
The
airDropTokens()
function in theNextGenCore
contract is responsible for minting and transferring an NFT to a user, exclusively called by theMinterContract
. However, the execution ofairDropTokens()
withinMinterContract#mintAndAuction()
prior to critical calculations results in the emission of a successfulTransfer
event, even if the transaction is eventually reverted due to errors in calculations. This inconsistency can lead to accounting issues in off-chain systems that rely on events for synchronization with the smart contract.Proof of Concept
The
Transfer
event is emitted on line 282 even when therequire
statement on line 294 fails.https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/MinterContract.sol#L282C8-L294C44
Test
Test Result
See, this function emit
emit Transfer(from: 0x0000000000000000000000000000000000000000, to: 0x6813Eb9362372EEF6200f3b1dbC3f819671cBA69, tokenId: 10000000001 [1e10])
event, even if the transaction has failedTools Used
Manual review and Foundry
Recommended Mitigation Steps
Invoke
airDropTokens
after the crucial operations to ensure that theTransfer
event is triggered only when the calculations are successful.Assessed type
ERC721