Skip to content
Business logic Audit finding Beginner

GiantPool should not check ETH amount on withdrawal

The GiantPoolBase.withdrawETH function requires the withdrawal amount to be at least MIN_STAKING_AMOUNT, which prevents users from withdrawing smaller remaining balances. An attacker could not exploit this, but a user could be forced to deposit more funds to withdraw their own ETH, incurring extra fees.

aphak5010 Follow with Trust, Jeiwan and 2 others

Originally disclosed on Code4rena

Submitted by aphak5010, also found by Trust, Jeiwan, yixxas, and HE1M

The GiantPoolBase.withdrawETH function requires that the amount to withdraw is at least as big as the MIN_STAKING_AMOUNT (https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantPoolBase.sol#L53).

This check does not serve any purpose and can actually cause the user problems when withdrawing his ETH.

Proof of Concept

  1. Bob deposits ETH into the GiantPool with the GiantPoolBase.depositETH function. The amount is equal to MIN_STAKING_AMOUNT + 0.99 * MIN_STAKING_AMOUNT.
  2. Bob witdraws MIN_STAKING_AMOUNT ETH from the GiantPool.
  3. Bob has 0.99 * MIN_STAKING_AMOUNT ETH left in the GiantPool. This is a problem since he cannot withdraw this amount of ETH since it is smaller than MIN_STAKING_AMOUNT. In order to withdraw his funds, Bob needs to first add funds to the GiantPool such that the deposited amount is big enough for withdrawal. However this causes extra transaction fees to be paid (loss of funds) and causes a bad user experience.

Tools Used

VSCode

Recommended Mitigation Steps

The require(_amount >= MIN_STAKING_AMOUNT, "Invalid amount"); statement should just be removed. It does not serve any purpose anyway.

vince0656 (Stakehouse) confirmed


The original report as published on Code4rena, by aphak5010. 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 withdrawal function incorrectly enforces a minimum amount check that is only relevant for staking, not for withdrawals.

Impact

Users may be unable to withdraw small remaining balances without depositing more ETH, leading to extra transaction fees and a poor user experience.

What the attacker needed

User has deposited ETH into GiantPool; User attempts to withdraw less than MIN_STAKING_AMOUNT

The fix

The require statement enforcing the minimum amount should be removed.

How it was found

  1. Bob deposits ETH into the GiantPool with the GiantPoolBase.depositETH function, using an amount equal to MIN_STAKING_AMOUNT + 0.99 * MIN_STAKING_AMOUNT.
  2. Bob withdraws MIN_STAKING_AMOUNT ETH from the GiantPool.
  3. Bob has 0.99 * MIN_STAKING_AMOUNT ETH left in the GiantPool, which he cannot withdraw because it is smaller than MIN_STAKING_AMOUNT.
  4. To withdraw his funds, Bob must first add more funds to the GiantPool, causing extra transaction fees and a bad user experience.

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.

This is a smart contract bug where a withdrawal function has an unnecessary minimum amount check. If you deposit a bit more than the minimum and then withdraw the minimum, the leftover amount is too small to withdraw, so you have to deposit more money just to get your own funds out, which costs extra fees.

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 aphak5010

View all

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