Skip to content
DoS Audit finding Intermediate

Giant pools cannot receive ETH from vaults

The giant pools lack a fallback or receive function, so when the vaults try to send back unused ETH via a low-level call, the transfer fails and the whole function reverts. As a result, unused ETH stays in the vaults and cannot be used to cover withdrawals, potentially causing insolvency.

0xdeadbeef0x Follow with datapunk, bin2chen and 2 others

Originally disclosed on Code4rena

Submitted by 0xdeadbeef0x, also found by datapunk, bin2chen, hihen, and koxuan

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

Both giant pools are affected:

  1. GiantSavETHVaultPool
  2. bringUnusedETHBackIntoGiantPool

The giant pools have a bringUnusedETHBackIntoGiantPool function that calls the vaults to send back any unused ETH. Currently, any call to this function will revert. Unused ETH will not be sent to the giant pools and will stay in the vaults.

This causes an insolvency issue when many users want to withdraw ETH and there is not enough liquidity inside the giant pools.

Proof of Concept

bringUnusedETHBackIntoGiantPool calls the vaults to receive ETH: https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantSavETHVaultPool.sol#L137

    function bringUnusedETHBackIntoGiantPool(
        address[] calldata _savETHVaults,
        LPToken[][] calldata _lpTokens,
        uint256[][] calldata _amounts
    ) external {
        uint256 numOfVaults = _savETHVaults.length;
        require(numOfVaults > 0, "Empty arrays");
        require(numOfVaults == _lpTokens.length, "Inconsistent arrays");
        require(numOfVaults == _amounts.length, "Inconsistent arrays");
        for (uint256 i; i < numOfVaults; ++i) {
            SavETHVault vault = SavETHVault(_savETHVaults[i]);
            for (uint256 j; j < _lpTokens[i].length; ++j) {
                require(
                    vault.isDETHReadyForWithdrawal(address(_lpTokens[i][j])) == false,
                    "ETH is either staked or derivatives minted"
                );
            }
            vault.burnLPTokens(_lpTokens[i], _amounts[i]);
        }
    }

the vaults go through a process of burning the _lpTokens and sending the caller giant pool ETH.

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

    function burnLPToken(LPToken _lpToken, uint256 _amount) public nonReentrant returns (uint256) {
        /// .....
        (bool result,) = msg.sender.call{value: _amount}("");
        // .....
    }

Giant pools do not have a fallback or receive function. ETH cannot be sent to them

Additionally, there is no accounting of idleETH, which should be increased with the received ETH in order to facilitate withdraws

Tools Used

VS Code

Recommended Mitigation Steps

  1. Add a fallback or receive function to the pools.
  2. idleETH should be increased with the received ETH

vince0656 (Stakehouse) confirmed


The original report as published on Code4rena, by 0xdeadbeef0x. 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

Impact

Unused ETH cannot be returned to the giant pools, which may cause insolvency when many users want to withdraw and there is not enough liquidity in the pools.

What the attacker needed

Users have deposited ETH into vaults; unused ETH exists in vaults; caller invokes bringUnusedETHBackIntoGiantPool

The fix

Add a fallback or receive function to the pools and increase idleETH accounting with the received ETH.

How it was found

  1. Call bringUnusedETHBackIntoGiantPool on a giant pool with valid vault and LP token arrays.
  2. The function calls burnLPTokens on each vault.
  3. The vault's burnLPToken attempts to send ETH to the giant pool via a low-level call.
  4. Because the giant pool has no receive or fallback function, the ETH transfer fails and the call reverts.

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 smart contract can only accept plain Ether transfers if it has a special function to receive them. These pool contracts do not have that function, so when another contract tries to send Ether back, the transfer fails and the whole operation is cancelled. This means money that should return to the pool gets stuck elsewhere, and users may not be able to withdraw.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0xdeadbeef0x

View all

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

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.