Althea Liquid Infrastructure - rokinot'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: 20/84

Findings: 1

Award: $242.11

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

242.1143 USDC - $242.11

Labels

bug
2 (Med Risk)
satisfactory
duplicate-82

External Links

Lines of code

https://github.com/code-423n4/2024-02-althea-liquid-infrastructure/blob/main/liquid-infrastructure/contracts/LiquidInfrastructureERC20.sol#L359

Vulnerability details

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.

Impact

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.

Proof of Concept

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 time withdrawFromManagedNFTs() is called, the function will revert because it's trying to access index 3, when the array only allows access up to index 2.

Tools Used

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;
...

Assessed type

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

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