Skip to content
Business logic Audit finding Intermediate

Giant pools are prone to user griefing, preventing their holdings from being staked

The batchRotateLPTokens function in the GiantMevAndFeesPool lets any user rotate LP tokens between staking funds vaults, and the only guard is a 0.5 ether lpTokenETH balance that can be obtained and burned at will. A malicious user could therefore keep moving LP tokens around and stop the pool's holdings from being staked by the liquid staking manager.

Trust Follow

Originally disclosed on Code4rena

Submitted by Trust

https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantMevAndFeesPool.sol#L105

batchRotateLPTokens in GiantMevAndFeesPool allows any user to rotate LP tokens of stakingFundsVaults around.

function batchRotateLPTokens(
    address[] calldata _stakingFundsVaults,
    LPToken[][] calldata _oldLPTokens,
    LPToken[][] calldata _newLPTokens,
    uint256[][] calldata _amounts
) external {
    uint256 numOfRotations = _stakingFundsVaults.length;
    require(numOfRotations > 0, "Empty arrays");
    require(numOfRotations == _oldLPTokens.length, "Inconsistent arrays");
    require(numOfRotations == _newLPTokens.length, "Inconsistent arrays");
    require(numOfRotations == _amounts.length, "Inconsistent arrays");
    require(lpTokenETH.balanceOf(msg.sender) >= 0.5 ether, "No common interest");
    for (uint256 i; i < numOfRotations; ++i) {
        StakingFundsVault(payable(_stakingFundsVaults[i])).batchRotateLPTokens(_oldLPTokens[i], _newLPTokens[i], _amounts[i]);
    }
}

There is a check that sender has over 0.5 ether of lpTokenETH, to prevent griefing. However, this check is unsatisfactory as user can at any stage deposit ETH to receive lpTokenETH and burn it to receive back ETH. Their lpTokenETH holdings do not correlate with their interest in the vault funds.

Therefore, malicious users can keep bouncing LP tokens around and prevent them from being available for actual staking by liquid staking manager.

Impact

Giant pools are prone to user griefing, preventing their holdings from being staked.

Recommended Mitigation Steps

Three options:

  1. batchRotateLPTokens should have logic to enforce that this specific rotation is logical
  2. Only DAO or some priviledged user can perform Giant pool operations
  3. Make the caller have something to lose from behaving maliciously, unlike the current status.

vince0656 (Stakehouse) disputed and commented:

This doesn’t factor in that when ETH is supplied to a liquid staking network, it has 30 minutes to be utilized for staking with the BLS public key - giant pool users can manage this inventory and move the liquidity between BLS keys but that’s by design and as mentioned above cannot move for 30 minutes at a time. If it never gets used, it can always go back to the giant pool


The original report as published on Code4rena, by Trust. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the access check relies on a token balance that anyone can acquire and dispose of freely, so it does not prove the caller has a lasting stake in the pool.

What the attacker needed

Holds at least 0.5 ether of lpTokenETH; can deposit and burn lpTokenETH freely

The fix

The report suggests enforcing that each rotation is logical, restricting giant pool operations to the DAO or a privileged user, or making the caller lose something if they behave maliciously.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A liquid staking pool holds users' deposits and hands them to a manager who stakes them. This report says a function that shuffles internal pool tokens can be called by anyone, and the small balance check can be dodged by depositing and withdrawing. So someone could keep disturbing the pool and stop the money being staked.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Trust

View all

77 more disclosed reports, best first.

More from LSD Network - Stakehouse contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.