Platform: Code4rena
Start Date: 13/02/2024
Pot Size: $24,500 USDC
Total HM: 5
Participants: 84
Period: 6 days
Judge: 0xA5DF
Id: 331
League: ETH
Rank: 20/84
Findings: 1
Award: $242.11
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: SpicyMeatball
Also found by: BowTiedOriole, Breeje, CaeraDenoir, JohnSmith, Krace, Meera, PumpkingWok, SovaSlava, SpicyMeatball, d3e4, juancito, kutugu, nuthan2x, rokinot, rouhsamad, web3pwn
242.1143 USDC - $242.11
In LiquidInfrastructureERC20.sol
, the function withdrawFromManagedNFTs()
serves to withdraw ERC20 assets from the managed NFTs that are held by the contract. This function has no control access, therefore anyone can call it. This function will pull numWithdrawals
funds and save the current index. However, if the owner of the contract removes an amount of managed NFTs that put the current index out of range, the function will always revert.
The owner will DoS the withdrawal of assets to the contract, regardless of intention. Submitting as a medium since in theory the admin could add mock liquid infra contracts just to restart the loop.
Assume a LiquidInfrastructureERC20 holds 5 ManagedNFTs contracts, and the distribution process has begun User calls
withdrawFromManagedNFTs(4)
The owner proceeds to remove the last 2 elements from the managed NFTs array, leaving 3 managed NFTs remaining, with indexes 0, 1 and 2. Next timewithdrawFromManagedNFTs()
is called, the function will revert because it's trying to access index 3, when the array only allows access up to index 2.
Manual code reading
Before the loop begins, add a check to see if nextWithdrawal
is higher than numWithdrawals + nextWithdrawal
or ManagedNFTs.length
.
... uint256 limit = Math.min( numWithdrawals + nextWithdrawal, ManagedNFTs.length ); if (nextWithdrawal > limit) nextWithdrawal = limit; uint256 i; ...
DoS
#0 - c4-pre-sort
2024-02-21T05:45:20Z
0xRobocop marked the issue as duplicate of #130
#1 - c4-pre-sort
2024-02-21T05:45:34Z
0xRobocop marked the issue as duplicate of #130
#2 - c4-judge
2024-03-03T13:00:48Z
0xA5DF marked the issue as satisfactory