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: 64/84
Findings: 1
Award: $7.18
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: BowTiedOriole
Also found by: 0x0bserver, 0xAadi, 0xJoyBoy03, 0xlamide, 0xlemon, 0xpiken, Babylen, Breeje, Brenzee, CodeWasp, DanielArmstrong, DarkTower, Fassi_Security, Fitro, Honour, JohnSmith, Krace, MrPotatoMagic, Myrault, ReadyPlayer2, SovaSlava, SpicyMeatball, TheSavageTeddy, Tigerfrake, atoko, cryptphi, csanuragjain, d3e4, gesha17, kinda_very_good, krikolkk, matejdb, max10afternoon, miaowu, n0kto, nuthan2x, parlayan_yildizlar_takimi, peanuts, petro_1912, pontifex, psb01, pynschon, rouhsamad, shaflow2, slippopz, spark, turvy_fuzz, web3pwn, zhaojohnson
7.1828 USDC - $7.18
https://github.com/code-423n4/2024-02-althea-liquid-infrastructure/blob/main/liquid-infrastructure/contracts/LiquidInfrastructureERC20.sol#L127-L146 https://github.com/code-423n4/2024-02-althea-liquid-infrastructure/blob/main/liquid-infrastructure/contracts/LiquidInfrastructureERC20.sol#L184-L189 https://github.com/code-423n4/2024-02-althea-liquid-infrastructure/blob/main/liquid-infrastructure/contracts/LiquidInfrastructureERC20.sol#L198-L237
Due to incorrect implementation of _beforeTokenTransfer(), each time when contract tokens are burned address(0) will be added to holders[] array which will result in DOS while distributing ERC20s tokens to all holders.
Whenever tokens are burned in _beforeTokenTransfer()
bool exists = (this.balanceOf(to) != 0)
=> (exists = false).if(!exists)
execute (as !exists = true) and address(0) will be pushed in holders[] array.1st case - When distributeToAllHolders() is called holder.length is passed to distribute() function. Inside distribute() function for (i = nextDistributionRecipient; i < limit; i++)
will try to distribute ERC20s tokens to all holders which may consists of lots of address(0) also which results out of gas errors.
Although as address(0) is not in HolderAllowlist[] so no token will be transfered to address(0) (again there is no zero address check in approveHolder() but it has onlyOwner modifier so considering address(0) will not be approved holder).
2nd case - when distribute() function is called with (say numDistributions = 3) then while distributing inside for (i = nextDistributionRecipient; i < limit; i++)
loop if index i = nextDistributionRecipient to next 2 indices consist of address(0) then no distributions will be made to approved holders.
Manual
Apply check to ensure to != address(0)
before pushing inside holders[].
DoS
#0 - c4-pre-sort
2024-02-20T03:23:05Z
0xRobocop marked the issue as duplicate of #727
#1 - c4-pre-sort
2024-02-20T06:34:10Z
0xRobocop marked the issue as duplicate of #77
#2 - c4-judge
2024-03-04T13:06:37Z
0xA5DF marked the issue as satisfactory