The Membership1155::burnBatchMultiple
burns all tokens of multiple users iterating over each element in the froms
array without an upper bound. This leads to gas exhaustion if the array is very large, causing the transaction to fail and no burns can happen.
The for
loop in the burnBatchMultiple
function does not have an upper bound, it will attempt to process all the burns in a single transaction. If the from
array has a large number of users, the gas required to execute the function may exceed the block gas limit, resulting in a failed transaction.
POC:
Set the project for using foundry:
Run: npm install --save-dev @nomicfoundation/hardhat-foundry
in the harhdat.config.ts file add this line: import "@nomicfoundation/hardhat-foundry";
run: npx hardhat init-foundry
in the test folder create a file named BurnButchMultipleOutOfGastTest.t.sol and copy and paste this into the file:
The test shows that if the from
array contains more than 2285 users, the function reverts and all the burns are reverted. No burn can happen inside the transaction. Considering that a DAO can have a large number of users (for example: the sponsored DAO can have a max number of users equal to 19825) is reasonable to consider that can be necessary to burn all tokens of a large number of users.
Manual review
Implement an upper limit to handle the burn of the token of a max number of users.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.