Althea Liquid Infrastructure - psb01's results

Liquid Infrastructure.

General Information

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

Althea

Findings Distribution

Researcher Performance

Rank: 64/84

Findings: 1

Award: $7.18

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

Impact

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.

Proof of Concept

Whenever tokens are burned in _beforeTokenTransfer()

  1. address to = address(0).
  2. bool exists = (this.balanceOf(to) != 0) => (exists = false).
  3. In next line statement inside 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.

Tools Used

Manual

Apply check to ensure to != address(0) before pushing inside holders[].

Assessed type

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

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